用substring(int start,int end);程序如下:public class 截取字符串{public static void main(String[] args){ String str = "weicc-20100107-00001"; str = str.substring(str.length()-5,str.length()); System.out.println(str);//输出}};