C# Class Utilities.StringUtilities

Extension methods for strings.
显示文件 Open project: agardiner/hfmcmd Class Usage Examples

Public Methods

Method Description
Capitalize ( this s ) : string

Capitalizes the first letter of a string

FromVersion ( System.Version ver ) : String
Join ( IEnumerable items, string separator ) : string

More generic version of Join, accepting any objects (and calling ToString on them to get the string values) to join.

SplitCSV ( this line ) : string[]

Splits a line of text into comma-separated fields. Handles quoted fields containing commas.

SplitQuoted ( this line, string separator ) : string[]

Splits a line of text into fields on the specified separator. Handles quoted fields that contain the separator.

SplitSpaces ( this line ) : string[]

Splits a line of text into space-separated fields. Handles quoted fields containing spaces.

ToVersion ( this version ) : System.Version

HFM version numbers don't follow the standard version numbering scheme, with breaking changes regularly introduced in patch-level updates! To handle this, we convert 5-part version specs to Version objects where the 4th and 5th numbers are merged into a single Revision number. The individual values can be returned using MajorRevision and MinorRevision properties.

Method Details

Capitalize() public static method

Capitalizes the first letter of a string
public static Capitalize ( this s ) : string
s this
return string

FromVersion() public static method

public static FromVersion ( System.Version ver ) : String
ver System.Version
return String

Join() public static method

More generic version of Join, accepting any objects (and calling ToString on them to get the string values) to join.
public static Join ( IEnumerable items, string separator ) : string
items IEnumerable
separator string
return string

SplitCSV() public static method

Splits a line of text into comma-separated fields. Handles quoted fields containing commas.
public static SplitCSV ( this line ) : string[]
line this
return string[]

SplitQuoted() public static method

Splits a line of text into fields on the specified separator. Handles quoted fields that contain the separator.
public static SplitQuoted ( this line, string separator ) : string[]
line this
separator string
return string[]

SplitSpaces() public static method

Splits a line of text into space-separated fields. Handles quoted fields containing spaces.
public static SplitSpaces ( this line ) : string[]
line this
return string[]

ToVersion() public static method

HFM version numbers don't follow the standard version numbering scheme, with breaking changes regularly introduced in patch-level updates! To handle this, we convert 5-part version specs to Version objects where the 4th and 5th numbers are merged into a single Revision number. The individual values can be returned using MajorRevision and MinorRevision properties.
public static ToVersion ( this version ) : System.Version
version this
return System.Version