Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通过将它们读入文件流并逐字节比较来比较两个文件。比较时如何跳过空格?我正在使用 C#.net
byte b; // .... if (Char.IsWhiteSpace((char) b)) { // skip... }
编辑:正如 Eric Lippert 指出的那样,只有当文件的编码是纯 7 位 ASCII 时,这才是正确的。在任何其他编码中,它将跳过相关字节。因此,您应该考虑数据的编码。