public class StringTest { /** * 怎么截取24,122,怎么截取某个特定字符前面的数据,且特定字符后面的有规律 * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub String a = "24.12"; String b = "122.12"; System.out.println(a.substring(0, a.indexOf("."))); } }