} // public static char [ ] CharToArray /// <summary> /// Split a string containing lines of text into an array of strings. /// </summary> /// <param name="pstrLines"> /// String containing lines of text, terminated by CR/LF pairs. /// </param> /// <returns> /// Array of strings, one line per string. Blank lines are preserved as /// empty strings. /// </returns> public static string [ ] StringOfLinesToArray ( string pstrLines ) { if ( pstrLines == null ) return new string [ ] { }; // Return an empty array. if ( pstrLines.Length == MagicNumbers.ZERO ) return new string [ ] { }; // Return an empty array. return pstrLines.Split ( TextBlocks.StringToArray ( SpecialStrings.STRING_SPLIT_NEWLINE ) , StringSplitOptions.None ); } // public static string [ ] StringOfLinesToArray {1 of 2)
} // public static string [ ] StringOfLinesToArray {1 of 2) /// <summary> /// Split a string containing lines of text into an array of strings, /// as modified by the StringSplitOptions flag. /// </summary> /// <param name="pstrLines"> /// String containing lines of text, terminated by CR/LF pairs. /// </param> /// <param name="penmStringSplitOptions"> /// A member of the StringSplitOptions enumeration, presumably other /// than StringSplitOptions.None, which is assumed by the first /// overload. The only option supported by version 2 of the Microsoft /// .NET CLR is RemoveEmptyEntries. /// </param> /// <returns> /// Array of strings, one line per string. Blank lines are preserved as /// empty strings unless penmStringSplitOptions is RemoveEmptyEntries, /// as is most likely to be the case. /// </returns> /// <remarks> /// Use this overload to convert a string, discarding blank lines. /// </remarks> public static string [ ] StringOfLinesToArray ( string pstrLines , StringSplitOptions penmStringSplitOptions ) { if ( string.IsNullOrEmpty ( pstrLines ) ) { return new string [ ] { }; // Return an empty array. } // if ( string.IsNullOrEmpty ( pstrLines ) ) return pstrLines.Split ( TextBlocks.StringToArray ( SpecialStrings.STRING_SPLIT_NEWLINE ) , penmStringSplitOptions ); } // public static string [ ] StringOfLinesToArray {2 of 2)