特定のテキストファイルの行をチェックしています。行には空白が含まれていて、空白ではなく行内の単語の数を調べることにのみ関心があります。私が行いますパラメータなしの分割とRemoveEmptyEntriesオプションの使用の違い
string[] arrParts = strLine.Trim().Split();
if (arrParts.Length > 0)
{
...
}
を今、MSDNによると、
If the separator parameter is null or contains no characters, white-space characters are assumed to be the delimiters. White-space characters are defined by the Unicode standard and return true if they are passed to the Char.IsWhiteSpace method.
IsWhiteSpace
方法はusuals含む空白の多くの多様な形態について説明しますが、最近私が使用この形式を見てきました' ' \t and \n
を:
Split(new char[0], StringSplitOptions.RemoveEmptyEntries)
これはどう違うのですか?