如何清理像ÿþ这样的字节字符? [英] How to clean up byte character like ÿþ?

查看:77
本文介绍了如何清理像ÿþ这样的字节字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Scala 并尝试将一些字符串整数存储为直接整数.然而,一些字符串整数在数字前面有一个 ÿþ 的格式.

I was using Scala and try to store some String Integer as straight Integer. However some String Integer has a format of this ÿþ in front of the number.

我该如何清理?为什么会发生这种情况?

How do I clean this up? Why does this happen?

改写的问题:

如何检查像 ÿþ 这样的所有字符并删除它们,以便我可以安全地将字符串转换为整数?我不知道这是否只出现在第一行.该文件有 16,000 行,虽然目前我只在第一行看到它,但我不能确定.

How do I check all characters like ÿþand delete them so I can safely convert Strings to Integer? I don't know if this appears only on the first line or not. The file has 16,000 lines and although I only see it at the first line so far, I can't be sure.

推荐答案

这两个是字节顺序标记 UTF-16.

These two are the Byte order mark of UTF-16.

您可以使用来自 Apache Commons IO 的工具.

这篇关于如何清理像ÿþ这样的字节字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆