import java.util.Arrays; public class Main { public static void main(String[] argv) throws Exception { String testStr = "one, two, three"; System.out.println("Original string: " + testStr); String[] result = testStr.split(",\\s*"); System.out.print("Split at commas: "); System.out.println(Arrays.toString(result)); } } /* Original string: one, two, three Split at commas: [one, two, three] */