I have strings in Java where each one is as follows: "Case Number XXX-XXX-XXX"
The "XXX-XXX-XXX" part is different for each string. I want to just extract the "XXX-XXX-XXX" portion of each string. I am assuming this is the third token in the string. What would be the best way of doing this? thanks.
ashkash 0 Newbie Poster
Recommended Answers
Jump to Posttry StringBuffer() easier, faster and easier to read than a Regex solution
String one = "Case number 123-456-789"; String two = one.substring(one.indexOf("r") + 2, one.length());
All 3 Replies
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
arun.reginald 0 Newbie Poster
stultuske 1,116 Posting Maven Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.