aspose file tools*
The moose likes Beginning Java and the fly likes find particular characters within a String ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "find particular characters within a String ? " Watch "find particular characters within a String ? " New topic
Author

find particular characters within a String ?

kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1376
How to find particular characters within a String ? indexOf() (or) contains() (or) any other optimized way ? Which is the best option ?
Daesung Park
Ranch Hand

Joined: Mar 22, 2007
Posts: 68
I think indexOf() is enough.


Daesung Park

BLOG
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1376
If i use indexOf(), can i find last occurrence of a character or a substring in the invoking string (or) can i use lastIndexOf() ?
Prashant Ladha
Greenhorn

Joined: Feb 06, 2008
Posts: 8
Also, please look at regex.
Prashant Ladha
Greenhorn

Joined: Feb 06, 2008
Posts: 8
Originally posted by kri shan:
If i use indexOf(), can i find last occurrence of a character or a substring in the invoking string (or) can i use lastIndexOf() ?


yes, with lastIndexOf(String) you would get the last occurrence of that string.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: find particular characters within a String ?