trim() and split() in java

Java
String[] splitted = "peter,james,thomas".split(",");


Source

Also in Java: