C# Class BF2Statistics.StringExtensions

Mostrar archivo Open project: BF2Statistics/ControlCenter

Public Methods

Method Description
CutTolength ( this str, int maxLength ) : string

Returns the input string at the maximum lenght provided. Excess string length will be removed from the end of the string. This method is very similar to using String.SubString(0, maxLength), but without an exception being thrown if the lentgh is greater than the length of the string.

EscapeXML ( this s ) : string

Escapes this string, so it may be stored inside an XML format

GetMD5Hash ( this input, bool upperCase = true, Encoding Encoding = null ) : string

Converts the input string into its MD5 Hex variant

IndexesOf ( this str, string value ) : List

Returns all the index's of the given string input

Inverse ( this input ) : string

Returns this string, in reverse order (abcde becomes edcba)

LowercaseFirst ( this s ) : string

Takes a string, and Lowercases the first letter

MakeFileNameSafe ( this fileName ) : string

Removes any invalid file path characters from this string

Repeat ( this input, int count = 1, string delimiter = "" ) : string

Repeats the current string the number of times specified

SplitBySize ( this str, int chunkSize ) : IEnumerable

Returns an Enumeration of this string, split by the specified size

ToTitleCase ( this s ) : string

Converts each word's first letter in the string to Uppercase (Invarient Culture)

ToTitleCase ( this s, CultureInfo cultureInfo ) : string

Converts each word's first letter in the string to Uppercase using the specified culture

UnescapeXML ( this s ) : string

Removes and XML converted formating back into its original value.

UppercaseFirst ( this s ) : string

Takes a string, and Uppercases the first letter

Method Details

CutTolength() public static method

Returns the input string at the maximum lenght provided. Excess string length will be removed from the end of the string. This method is very similar to using String.SubString(0, maxLength), but without an exception being thrown if the lentgh is greater than the length of the string.
public static CutTolength ( this str, int maxLength ) : string
str this
maxLength int
return string

EscapeXML() public static method

Escapes this string, so it may be stored inside an XML format
public static EscapeXML ( this s ) : string
s this
return string

GetMD5Hash() public static method

Converts the input string into its MD5 Hex variant
public static GetMD5Hash ( this input, bool upperCase = true, Encoding Encoding = null ) : string
input this
upperCase bool Uppercase the characters?
Encoding System.Text.Encoding The encoding of the string. Default is UTF8
return string

IndexesOf() public static method

Returns all the index's of the given string input
public static IndexesOf ( this str, string value ) : List
str this
value string
return List

Inverse() public static method

Returns this string, in reverse order (abcde becomes edcba)
public static Inverse ( this input ) : string
input this
return string

LowercaseFirst() public static method

Takes a string, and Lowercases the first letter
public static LowercaseFirst ( this s ) : string
s this The input string
return string

MakeFileNameSafe() public static method

Removes any invalid file path characters from this string
public static MakeFileNameSafe ( this fileName ) : string
fileName this
return string

Repeat() public static method

Repeats the current string the number of times specified
public static Repeat ( this input, int count = 1, string delimiter = "" ) : string
input this The string that is being repeated
count int The number of times to repeat this string
delimiter string The sequence of one or more characters used to specify the boundary between repeats
return string

SplitBySize() public static method

Returns an Enumeration of this string, split by the specified size
public static SplitBySize ( this str, int chunkSize ) : IEnumerable
str this
chunkSize int The size of each chunk, in which this string is split by
return IEnumerable

ToTitleCase() public static method

Converts each word's first letter in the string to Uppercase (Invarient Culture)
public static ToTitleCase ( this s ) : string
s this the input string
return string

ToTitleCase() public static method

Converts each word's first letter in the string to Uppercase using the specified culture
public static ToTitleCase ( this s, CultureInfo cultureInfo ) : string
s this
cultureInfo System.Globalization.CultureInfo The culture info to use
return string

UnescapeXML() public static method

Removes and XML converted formating back into its original value.
public static UnescapeXML ( this s ) : string
s this
return string

UppercaseFirst() public static method

Takes a string, and Uppercases the first letter
public static UppercaseFirst ( this s ) : string
s this The input string
return string