Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to find substring after a given separator in Java String

 
sony vijay
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Answer: I guess using StringUtils.subStringAfter() function should do this. I am not sure how to delete the post so am posting the answer myself

Question: Say I have a String like so: "prefix_somestring"

Is there a way to find substring after the separator "prefix_" i.e. the output should be "somestring"

 
Hebert Coelho
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
 
Campbell Ritchie
Sheriff
Pie
Posts: 48967
60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you not know how to find the index of the _ character?
 
Enrico Rosina
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Is this what you are looking for (?) :
 
ujjawal rohra
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use :

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic