C# Class RestSharp.Extensions.StringExtensions

ファイルを表示 Open project: nicwise/RestSharp

Public Methods

Method Description
AddDashes ( this pascalCasedWord ) : string

Add dashes to a pascal-cased string

AddUnderscores ( this pascalCasedWord ) : string

Add underscores to a pascal-cased string

GetNameVariants ( this name, CultureInfo culture ) : IEnumerable

Return possible variants of a name for name matching.

HasValue ( this input ) : bool

Check that a string is not null or empty

HtmlAttributeEncode ( this input ) : string
HtmlDecode ( this input ) : string
HtmlEncode ( this input ) : string
IsUpperCase ( this inputString ) : bool

Checks to see if a string is all uppper case

MakeInitialLowerCase ( this word ) : string

Convert the first letter of a string to lower case

Matches ( this input, string pattern ) : bool

Checks a string to see if it matches a regex

ParseJsonDate ( this input, CultureInfo culture ) : System.DateTime

Parses most common JSON date formats

RemoveSurroundingQuotes ( this input ) : string

Remove leading and trailing " from a string

RemoveUnderscoresAndDashes ( this input ) : string

Remove underscores from a string

ToCamelCase ( this lowercaseAndUnderscoredWord, CultureInfo culture ) : string

Converts a string to camel case

ToPascalCase ( this lowercaseAndUnderscoredWord, CultureInfo culture ) : string

Converts a string to pascal case

ToPascalCase ( this text, bool removeUnderscores, CultureInfo culture ) : string

Converts a string to pascal case with the option to remove underscores

UrlDecode ( this input ) : string
UrlEncode ( this input ) : string

Uses Uri.EscapeDataString() based on recommendations on MSDN http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx

Private Methods

Method Description
ExtractDate ( string input, string pattern, CultureInfo culture ) : System.DateTime
ParseFormattedDate ( string input, CultureInfo culture ) : System.DateTime

Method Details

AddDashes() public static method

Add dashes to a pascal-cased string
public static AddDashes ( this pascalCasedWord ) : string
pascalCasedWord this String to convert
return string

AddUnderscores() public static method

Add underscores to a pascal-cased string
public static AddUnderscores ( this pascalCasedWord ) : string
pascalCasedWord this String to convert
return string

GetNameVariants() public static method

Return possible variants of a name for name matching.
public static GetNameVariants ( this name, CultureInfo culture ) : IEnumerable
name this String to convert
culture System.Globalization.CultureInfo The culture to use for conversion
return IEnumerable

HasValue() public static method

Check that a string is not null or empty
public static HasValue ( this input ) : bool
input this String to check
return bool

HtmlAttributeEncode() public static method

public static HtmlAttributeEncode ( this input ) : string
input this
return string

HtmlDecode() public static method

public static HtmlDecode ( this input ) : string
input this
return string

HtmlEncode() public static method

public static HtmlEncode ( this input ) : string
input this
return string

IsUpperCase() public static method

Checks to see if a string is all uppper case
public static IsUpperCase ( this inputString ) : bool
inputString this String to check
return bool

MakeInitialLowerCase() public static method

Convert the first letter of a string to lower case
public static MakeInitialLowerCase ( this word ) : string
word this String to convert
return string

Matches() public static method

Checks a string to see if it matches a regex
public static Matches ( this input, string pattern ) : bool
input this String to check
pattern string Pattern to match
return bool

ParseJsonDate() public static method

Parses most common JSON date formats
public static ParseJsonDate ( this input, CultureInfo culture ) : System.DateTime
input this JSON value to parse
culture System.Globalization.CultureInfo
return System.DateTime

RemoveSurroundingQuotes() public static method

Remove leading and trailing " from a string
public static RemoveSurroundingQuotes ( this input ) : string
input this String to parse
return string

RemoveUnderscoresAndDashes() public static method

Remove underscores from a string
public static RemoveUnderscoresAndDashes ( this input ) : string
input this String to process
return string

ToCamelCase() public static method

Converts a string to camel case
public static ToCamelCase ( this lowercaseAndUnderscoredWord, CultureInfo culture ) : string
lowercaseAndUnderscoredWord this String to convert
culture System.Globalization.CultureInfo
return string

ToPascalCase() public static method

Converts a string to pascal case
public static ToPascalCase ( this lowercaseAndUnderscoredWord, CultureInfo culture ) : string
lowercaseAndUnderscoredWord this String to convert
culture System.Globalization.CultureInfo
return string

ToPascalCase() public static method

Converts a string to pascal case with the option to remove underscores
public static ToPascalCase ( this text, bool removeUnderscores, CultureInfo culture ) : string
text this String to convert
removeUnderscores bool Option to remove underscores
culture System.Globalization.CultureInfo
return string

UrlDecode() public static method

public static UrlDecode ( this input ) : string
input this
return string

UrlEncode() public static method

Uses Uri.EscapeDataString() based on recommendations on MSDN http://blogs.msdn.com/b/yangxind/archive/2006/11/09/don-t-use-net-system-uri-unescapedatastring-in-url-decoding.aspx
public static UrlEncode ( this input ) : string
input this
return string