How to using String.split in this case?
- by hoang nguyen
I want to write a fuction like that:
- Input: "1" -> return : "1"
- Input: "12" -> return : ["1","2"]
If I use the function split(): String.valueOf("12").split("") -> ["","1","2"]
But, I only want to get the result: ["1","2"].
What the best way to do this?
Infact, I can do that:
private List<String> decomposeQuantity(final…