troubleshooting Question

How do I split a string while sorting based on two different delimiters.

Avatar of becraig
becraigFlag for United States of America asked on
20 Comments1 Solution68 ViewsLast Modified:
I am trying to figure out a way to do the following in Java:

I have a string input, let's say: "1,2,3,4,9,23-4,98"

I need a way to do two things (I am sure there are easier ways so you can ignore my path if you can get to the destination):
1. split the string while retaining 23-4 as its own entry
2. Next I need to sort from smallest to largest
3. If any of the other numbers fall in the range "4-23" (once sorted) - I want to remove those.

So I should end up with:
as my final output.

Can anyone help me figure out how to do this in Java?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 20 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 20 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros