Forums Register Login

String.split() with null values

+Pie Number of slices to send: Send


The output of the above is : : : : bb

What exactly happens when the split() does a split but there is nothing in between the split as in the above example.
Is the value (in the array) classed as null or an empty string or something else?

Thanks
+Pie Number of slices to send: Send
If the Strings were null then printing them out would produce 'null' for each String. Doing

gives 'true', so yes the elements of the array are indeed empty strings.

John
+Pie Number of slices to send: Send
I wasnt actually expecting the empty strings. I thought the contents of the array would be {bb}
You guys haven't done this much, have ya? I suggest you study this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1359 times.
Similar Threads
splitting string into 2 variable
difference between null string and ""
String Tokenizing doubt
Garbage Collection
Why it want super class constructor
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 11:42:25.