C# Class Utilities.StringUtilities

Extension methods for strings.
Afficher le fichier Open project: agardiner/hfmcmd Class Usage Examples

Méthodes publiques

Méthode 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 méthode

Capitalizes the first letter of a string
public static Capitalize ( this s ) : string
s this
Résultat string

FromVersion() public static méthode

public static FromVersion ( System.Version ver ) : String
ver System.Version
Résultat String

Join() public static méthode

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
Résultat string

SplitCSV() public static méthode

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

SplitQuoted() public static méthode

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
Résultat string[]

SplitSpaces() public static méthode

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

ToVersion() public static méthode

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
Résultat System.Version