I am comparing to files by reading it into filestream and comparing byte by byte..now how can i skip whitespaces while comparing?I am using C#.net
From stackoverflow
-
byte b; // .... if (Char.IsWhiteSpace((char) b)) { // skip... }EDIT: As Eric Lippert points out, this is only correct if the encoding of the file is plain 7-bit ASCII. In any other encoding it will skip relevant bytes. So, you should take into account the encoding of your data.
Eric Lippert : This is only correct if the encoding of the file is plain 7 bit ASCII. In any other encoding it will skip relevant bytes.Mitch Wheat : @Eric Lippert: Hi, the poster said he was comparing bytes, but you are correct; he should be taking into account the encoding.
0 comments:
Post a Comment