File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes String splitting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String splitting" Watch "String splitting" New topic

String splitting

saikiran venkata

Joined: Oct 31, 2010
Posts: 29

hello everyone,

it is printing

....> <....
....> <....
....> <....

but there are no empty tokens in iran why?

SCJP 1.6 | SCWCD 5
The earth is enjoyed by heroes—this is the unfailing truth. Be a hero. Always say, “I have no fear." ~Swami Vivekananda.
Hareendra Reddy
Ranch Hand

Joined: Jan 09, 2011
Posts: 173

Hello Sai kiran ,

If you use split method of the string the trailing empty strings are discarded..
refer java.lang.String class documentation, there is another overloaded method which takes
one more integer as argument lets you include empty strings as well...
I agree. Here's the link:
subject: String splitting
It's not a secret anymore!