//去除字符串中的数字 private void testString(){ String string="0079527大白菜"; char foodName[]=string.toCharArray(); StringBuilder stringBuilder=new StringBuilder(); for (int i = 0; i < foodName.length; i++) { char c=foodName[i]; boolean isDigit=Character.isDigit(c); if (!isDigit) { stringBuilder.append(c); } } System.out.println("原来的字符串:"+string+",改后的字符串:"+stringBuilder.toString()); }