View Single Post
  #2 (permalink)  
Old 11-19-2007, 12:07 PM
Eranga's Avatar
Eranga Eranga is offline
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,543
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
First find the index of '(' and ')' signs, other words first and last occurrence of them within the string.

Code:
String ss = "Tom Cruise (125)"; // First occurrence of '(' int firstIndex = ss.indexOf('('); // gives a value // Last occurrence of ')' int lastIndex = ss.indexOf(')'); // or you can use lastIndexOf()
then find the substring using calculated values

Code:
String subSt = ss.substring((firstIndex + 1), (lastIndex - 1));
Hope it helps to you.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote