EDIT: now that you have provided some more context:
, string.Length. - , if, . , , .
, string.Split, , .
, char . , ?
. / , .
:
private static readonly char[] Delimiters = " ".ToCharArray();
private static readonly string[] EmptyArray = new string[0];
public static string[] SplitOnMultiSpaces(string text)
{
if (string.IsNullOrEmpty(text))
{
return EmptyArray;
}
return text.Split(Delimiters, StringSplitOptions.RemoveEmptyEntries);
}
string.Length . - , , , , ASCII ( ) . , , O (1), , JIT . ( extern, , , JIT - , .)
, ,
if (s.Length != 0)
- , IMO. :
if (s != "")
, , , . , , , . , , / , , . , , , , . , ?
EDIT: string.IsNullOrEmpty: , , null, . , , .
Length , : , . , , . , null , if. string.IsNullOrEmpty, null , .