
11-19-2007, 12:07 PM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,543
|
|
First find the index of '(' and ')' signs, other words first and last occurrence of them within the string.
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
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.
|