I know how to split a string by space as the following:
String[] array = string.split(" ");
This works great until I try to split string that starts with a space like
" I like apple"
The result looks something like this:
{"", "I", "like", "apple"}
How can I split the string so it only keeps strings that is not empty?