[java]处理utf-8 bom字符串的bom头

原文链接: https://yq.aliyun.com/articles/576458
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

猜你喜欢

转载自blog.csdn.net/qq_31433709/article/details/102573488