Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

split() method, How does it work???

 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Output:
>ab<
> ccc <
>< // Line 1
>< // Line 2
> <
>< // Line 3
> @<


Please Help regarding Line 1 , 2 and 3. What do they contain???



Regards,
cmbhatt
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Chandra Bhatt:
...Please Help regarding Line 1 , 2 and 3. What do they contain??? ...

Line 1 is the empty String between 4 and 5.
Line 2 is the empty String between 5 and 5.
Line 3 is the empty String between 6 and 7.
 
Chandra Bhatt
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
O I SEE!!!

Means if the splitting pattern is digit as I did, empty string
also come under a token!!! Right!!!



Thank you very much Marc!!!


cmbhatt
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!