how to split a string by whitespace java code example
Example 1: 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 2: how to strip spaces in java using split with other delimiters
String[] splitted = input. trim(). split("\\s*,\\s*");