I have a string /sample/data
. When I split using split
I get the following result,
["","sample","data"]
I want to ignore the empty string(s). So I tried the following code,
"/sample/data".split('/').findAll(it != "")
It gives me an error "cannot call String[] findAll with argument bool
".
How can I split and get a List without empty string in it?