char[] bomChar = "带bom的字符串".toCharArray();//转为char数组
char[] noneBomchar = new char[bomChar.length - 1];//数组第一个元素是bom头,去掉它
for (int j = 0; j < noneBomchar .length; j++) {
noneBomchar [j] = bomChar[j + 1];
}
String first = String.valueOf(noneBomchar );//重组转String
例如:
例子中的字符串中有bom头
处理之后: