C# Class Itenso.Sys.StringTool

ファイルを表示 Open project: Shereef/RTF-to-HTML-Converter-Class-Library-DLL Class Usage Examples

Public Methods

Method Description
FormatSafeInvariant ( string format ) : string
SplitQuoted ( string toSplit, char quote, char escape, bool includeEmptyUnquotedSections ) : string[]

Splits a string in the same way as the System.String.Split() method but with support for special treatment for escaped characters and for quoted sections which won't be split.

Escaping supports the following special treatment: escape is followed by 'n': a new line character is inserted escape is followed by 'r': a form feed character is inserted escape is followed by 't': a tabulator character is inserted escape is followed by 'x': the next two characters are interpreted as a hex code of the character to be inserted any other character after the escape is inserted literally Escaping is applied within and outside of quoted sections.

Private Methods

Method Description
GetHexValue ( char c ) : int

Method Details

FormatSafeInvariant() public static method

public static FormatSafeInvariant ( string format ) : string
format string
return string

SplitQuoted() public static method

Splits a string in the same way as the System.String.Split() method but with support for special treatment for escaped characters and for quoted sections which won't be split.
Escaping supports the following special treatment: escape is followed by 'n': a new line character is inserted escape is followed by 'r': a form feed character is inserted escape is followed by 't': a tabulator character is inserted escape is followed by 'x': the next two characters are interpreted as a hex code of the character to be inserted any other character after the escape is inserted literally Escaping is applied within and outside of quoted sections.
public static SplitQuoted ( string toSplit, char quote, char escape, bool includeEmptyUnquotedSections ) : string[]
toSplit string the string to split
quote char the quoting character, e.g. '"'
escape char an escaping character to use both within and outside /// of quoted sections, e.g. '\\'
includeEmptyUnquotedSections bool whether to return zero-length sections /// outside of quotations or not. empty sections adjacent to a quoted section are /// never returned.
return string[]