一: double a = 23.36; String b = String.valueOf(a); String d = b.substring(0, b.lastIndexOf(".")); System.out.println(d); 测试结果是:23 二: String s="信贷业务-快速贷/快逸贷/快易还,"; String d=s.substring(0, s.lastIndexOf(",")); System.out.println(d); 测试结果:信贷业务-快速贷/快逸贷/快易还