java split remove trailing whitespace code example
Example 1: how to strip trailing spaces in java
String str = new String(" apples ");
str.trim(); // result is a nes string "apple"
Example 2: how to strip spaces in java using split with other delimiters
String[] splitted = input. trim(). split("\\s*,\\s*");