C# Class Ext.Net.Utilities.StringUtils

Mostrar archivo Open project: extnet/Utilities

Public Methods

Method Description
Base64Decode ( this text ) : string

Base64 string decoder

Base64Encode ( this text ) : string

Base64 string encoder

Chop ( this text ) : string

Chops one character from each end of string.

Chop ( this text, int characters ) : string

Chops the specified number of characters from each end of string.

Chop ( this text, string character ) : string

Chops the specified string from each end of the string. If the character does not exist on both ends of the string, the characters are not chopped.

ConcatWith ( this instance ) : string

Add the args strings the source text string.

ConcatWith ( this instance, string text ) : string

Add the text string to the source string.

Contains ( this instance ) : bool

Determines if the string contains any of the args. If yes, returns true, otherwise returns false.

Ellipsis ( this text, int length ) : string

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length

Ellipsis ( this text, int length, bool word ) : string

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length

Enquote ( this text ) : string

EnsureSemiColon ( this text ) : string

FormatRegexPattern ( this regex ) : string

FormatWith ( this format ) : string

Format the string with the args.

FormatWith ( this format, IFormatProvider provider ) : string

FormatWith ( this format, object source ) : string

If ( this text, string test, string valueIfTrue ) : string

IfNot ( this text, string test, string valueIfTrue ) : string

IsEmpty ( this text ) : bool

Determine is the string is null or empty.

IsLowerCamelCase ( this text ) : bool

IsNotEmpty ( this text ) : bool

Determine is the string is NOT null or empty.

Join ( this items ) : string

Join ( this items, string separator ) : string

Join ( this items, string separator, string template ) : string

Join the items together

LeftOf ( this text, char c ) : string

Left of the first occurance of c

LeftOf ( this text, char c, int n ) : string

Left of the n'th occurance of c

LeftOf ( this text, string value ) : string

Left of the first occurance of text

LeftOfRightmostOf ( this text, char c ) : string

LeftOfRightmostOf ( this text, string value ) : string

PadLeft ( this text, char c, Int32 totalLength ) : string

Pad the left side of a string with characters to make the total length.

PadRight ( this text ) : string

Pad the right side of a string with a '0' if a single character.

PadRight ( this text, char c, Int32 totalLength ) : string

Pad the right side of a string with characters to make the total length.

Randomize ( this chars ) : string

Randomize ( this chars, int length ) : string

Generate a random string of character at a certain length

ReplaceLastInstanceOf ( this text, string oldValue, string newValue ) : string

RightOf ( this text, char c ) : string

Right of the first occurance of c

RightOf ( this text, char c, int n ) : string

Right of the n'th occurance of c

RightOf ( this text, string value ) : string

Right of the first occurance of text

RightOf ( this text, string c, int n ) : string

Right of the n'th occurance of c

RightOfRightmostOf ( this text, char c ) : string

RightOfRightmostOf ( this text, string value ) : string

Test ( this text, string pattern ) : bool

Test ( this text, string pattern, RegexOptions options ) : bool

ToCamelCase ( this text ) : string

ToCamelCase ( this values, string separator ) : string

ToCharacterSeparatedFileName ( this name, char separator, string extension ) : string

Accepts a string like "ArrowRotateClockwise" and returns "arrow_rotate_clockwise.png".

ToLowerCamelCase ( this text ) : string

ToMD5Hash ( this text ) : string

MD5Hash's a string.

ToTitleCase ( this text ) : string

Converts the first character of each word to Uppercase. Example: "the lazy dog" returns "The Lazy Dog"

ToTitleCase ( this text, CultureInfo ci ) : string

Converts the first character of each word to Uppercase. Example: "the lazy dog" returns "The Lazy Dog"

Wrap ( this text, string wrapByText ) : string

Wrap ( this text, string wrapStart, string wrapEnd ) : string

Private Methods

Method Description
Between ( this text, string start, string end ) : string
Eval ( object source, string expression ) : object

FormatWith ( this format, IFormatProvider provider, object source ) : string
Replace ( this instance, string oldValues, string>.Func convert ) : string
Replace ( this instance, string oldValues, string newValue ) : string
Subarray ( this items, int start ) : string[]
Subarray ( this items, int start, int length ) : string[]

Method Details

Base64Decode() public static method

Base64 string decoder
public static Base64Decode ( this text ) : string
text this The text string to decode
return string

Base64Encode() public static method

Base64 string encoder
public static Base64Encode ( this text ) : string
text this The text string to encode
return string

Chop() public static method

Chops one character from each end of string.
public static Chop ( this text ) : string
text this
return string

Chop() public static method

Chops the specified number of characters from each end of string.
public static Chop ( this text, int characters ) : string
text this
characters int
return string

Chop() public static method

Chops the specified string from each end of the string. If the character does not exist on both ends of the string, the characters are not chopped.
public static Chop ( this text, string character ) : string
text this
character string
return string

ConcatWith() public static method

Add the args strings the source text string.
public static ConcatWith ( this instance ) : string
instance this
return string

ConcatWith() public static method

Add the text string to the source string.
public static ConcatWith ( this instance, string text ) : string
instance this
text string
return string

Contains() public static method

Determines if the string contains any of the args. If yes, returns true, otherwise returns false.
public static Contains ( this instance ) : bool
instance this The instance of the string
return bool

Ellipsis() public static method

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
public static Ellipsis ( this text, int length ) : string
text this The string to truncate
length int The maximum length to allow before truncating
return string

Ellipsis() public static method

Truncate a string and add an ellipsis ('...') to the end if it exceeds the specified length
public static Ellipsis ( this text, int length, bool word ) : string
text this The string to truncate
length int The maximum length to allow before truncating
word bool True to try to find a common work break
return string

Enquote() public static method

public static Enquote ( this text ) : string
text this
return string

EnsureSemiColon() public static method

public static EnsureSemiColon ( this text ) : string
text this
return string

FormatRegexPattern() public static method

public static FormatRegexPattern ( this regex ) : string
regex this
return string

FormatWith() public static method

Format the string with the args.
public static FormatWith ( this format ) : string
format this
return string

FormatWith() public static method

public static FormatWith ( this format, IFormatProvider provider ) : string
format this
provider IFormatProvider
return string

FormatWith() public static method

public static FormatWith ( this format, object source ) : string
format this
source object
return string

If() public static method

public static If ( this text, string test, string valueIfTrue ) : string
text this
test string
valueIfTrue string
return string

IfNot() public static method

public static IfNot ( this text, string test, string valueIfTrue ) : string
text this
test string
valueIfTrue string
return string

IsEmpty() public static method

Determine is the string is null or empty.
public static IsEmpty ( this text ) : bool
text this
return bool

IsLowerCamelCase() public static method

public static IsLowerCamelCase ( this text ) : bool
text this
return bool

IsNotEmpty() public static method

Determine is the string is NOT null or empty.
public static IsNotEmpty ( this text ) : bool
text this
return bool

Join() public static method

public static Join ( this items ) : string
items this
return string

Join() public static method

public static Join ( this items, string separator ) : string
items this
separator string
return string

Join() public static method

Join the items together
public static Join ( this items, string separator, string template ) : string
items this The items to join.
separator string The separator.
template string The template to format the items with.
return string

LeftOf() public static method

Left of the first occurance of c
public static LeftOf ( this text, char c ) : string
text this
c char
return string

LeftOf() public static method

Left of the n'th occurance of c
public static LeftOf ( this text, char c, int n ) : string
text this
c char
n int
return string

LeftOf() public static method

Left of the first occurance of text
public static LeftOf ( this text, string value ) : string
text this
value string
return string

LeftOfRightmostOf() public static method

public static LeftOfRightmostOf ( this text, char c ) : string
text this
c char
return string

LeftOfRightmostOf() public static method

public static LeftOfRightmostOf ( this text, string value ) : string
text this
value string
return string

PadLeft() public static method

Pad the left side of a string with characters to make the total length.
public static PadLeft ( this text, char c, Int32 totalLength ) : string
text this
c char
totalLength System.Int32
return string

PadRight() public static method

Pad the right side of a string with a '0' if a single character.
public static PadRight ( this text ) : string
text this
return string

PadRight() public static method

Pad the right side of a string with characters to make the total length.
public static PadRight ( this text, char c, Int32 totalLength ) : string
text this
c char
totalLength System.Int32
return string

Randomize() public static method

public static Randomize ( this chars ) : string
chars this
return string

Randomize() public static method

Generate a random string of character at a certain length
public static Randomize ( this chars, int length ) : string
chars this The Characters to use in the random string
length int The length of the random string
return string

ReplaceLastInstanceOf() public static method

public static ReplaceLastInstanceOf ( this text, string oldValue, string newValue ) : string
text this
oldValue string
newValue string
return string

RightOf() public static method

Right of the first occurance of c
public static RightOf ( this text, char c ) : string
text this
c char
return string

RightOf() public static method

Right of the n'th occurance of c
public static RightOf ( this text, char c, int n ) : string
text this
c char
n int
return string

RightOf() public static method

Right of the first occurance of text
public static RightOf ( this text, string value ) : string
text this
value string
return string

RightOf() public static method

Right of the n'th occurance of c
public static RightOf ( this text, string c, int n ) : string
text this
c string
n int
return string

RightOfRightmostOf() public static method

public static RightOfRightmostOf ( this text, char c ) : string
text this
c char
return string

RightOfRightmostOf() public static method

public static RightOfRightmostOf ( this text, string value ) : string
text this
value string
return string

Test() public static method

public static Test ( this text, string pattern ) : bool
text this
pattern string
return bool

Test() public static method

public static Test ( this text, string pattern, RegexOptions options ) : bool
text this
pattern string
options RegexOptions
return bool

ToCamelCase() public static method

public static ToCamelCase ( this text ) : string
text this
return string

ToCamelCase() public static method

public static ToCamelCase ( this values, string separator ) : string
values this
separator string
return string

ToCharacterSeparatedFileName() public static method

Accepts a string like "ArrowRotateClockwise" and returns "arrow_rotate_clockwise.png".
public static ToCharacterSeparatedFileName ( this name, char separator, string extension ) : string
name this
separator char
extension string
return string

ToLowerCamelCase() public static method

public static ToLowerCamelCase ( this text ) : string
text this
return string

ToMD5Hash() public static method

MD5Hash's a string.
public static ToMD5Hash ( this text ) : string
text this
return string

ToTitleCase() public static method

Converts the first character of each word to Uppercase. Example: "the lazy dog" returns "The Lazy Dog"
public static ToTitleCase ( this text ) : string
text this The text to convert to sentence case
return string

ToTitleCase() public static method

Converts the first character of each word to Uppercase. Example: "the lazy dog" returns "The Lazy Dog"
public static ToTitleCase ( this text, CultureInfo ci ) : string
text this The text to convert to sentence case
ci System.Globalization.CultureInfo
return string

Wrap() public static method

public static Wrap ( this text, string wrapByText ) : string
text this
wrapByText string
return string

Wrap() public static method

public static Wrap ( this text, string wrapStart, string wrapEnd ) : string
text this
wrapStart string
wrapEnd string
return string