how to split a string with space in java code example
Example 1: space seperator in string in java
String[] splitted = "peter,james,thomas".split(",");
Example 2: hwo to split string by spaces in java
String lineOfCurrencies = "USD JPY AUD SGD HKD CAD CHF GBP EURO INR";
String[] currencies = lineOfCurrencies.split(" ");
Example 3: how to strip spaces in java using split with other delimiters
String[] splitted = input. trim(). split("\\s*,\\s*");