Using regular expressions:
Pattern p = Pattern.compile(".*,\s*(.*)");
Matcher m = p.matcher("abcd,fg;ijkl, cas");
if (m.find())
System.out.println(m.group(1));
Outputs:
cas
Or you can use simple String
methods:
System.out.println(s.substring(s.lastIndexOf(",") + 1).trim());
System.out.println(s.substring(s.lastIndexOf(", ") + 2));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…