Java String split String by . dot and trim space
public class Main { public static void main(String[] args) { String sampleString = "A . B . C"; String[] items = sampleString.split("\\s*\\.\\s*"); for (String item : items) { System.out.println(">"+item+"<"); }//from ww w.ja v a 2 s .c o m } }