Quantcast
Channel: string to string array conversion in java - Stack Overflow
Viewing all articles
Browse latest Browse all 16

Answer by rsp for string to string array conversion in java

$
0
0

To start you off on your assignment, String.split splits strings on a regular expression, this expression may be an empty string:

String[] ary = "abc".split("");

Yields the array:

(java.lang.String[]) [, a, b, c]

Getting rid of the empty 1st entry is left as an exercise for the reader :-)

Note: In Java 8, the empty first element is no longer included.


Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>