split string based on single or multiple spaces code example
Example 1: split funtion in string on multiple spaces
String[] sArray = s.split("\\s{2,}");
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(" ");