split string based on any no of whitespaces code example Example: space seperator in string in java String[] splitted = "peter,james,thomas".split(",");