This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "String splitting" Watch "String splitting" New topic
Author

String splitting

saikiran venkata
Greenhorn

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...
 
 
subject: String splitting
 
Similar Threads
String literal Pool doubt
Static blocks
error in formatting miliseconds for date objects
Binary to Decimal conversion
Understanding logic on for loop