C# Class Utilities.Extensions.StringExtensions

Mostra file Open project: feanz/Utilities

Public Methods

Method Description
AsciiToUnicode ( this asciiCode ) : string

Converts ASCII encoding to Unicode

Chop ( this text ) : string

Strips the last char from a a string.

Chop ( this text, int removeFromEnd ) : string

Strips the last specified chars from a string.

Chop ( this text, string backDownTo ) : string

Strips the last specified chars from a string.

Clip ( this text ) : string

Strips the last char from a a string.

Clip ( this text, int removeFromBeginning ) : string

Removes the specified chars from the beginning of a string.

Clip ( this text, string removeUpTo ) : string

Removes chars from the beginning of a string, up to the specified string

ContainsCaseInsensitive ( this text, string contains ) : bool

Validate that string contains string case insensitive search

Format ( this text ) : string

Formats the source text using the specified parameters

IsNotNullOrEmpty ( this text ) : bool

Verifies that the source text is not null or empty

IsNullOrEmpty ( this text ) : bool

Verifies that the source text is null or empty

IsSameAs ( this text, string match, System.StringComparison comparison = StringComparison.InvariantCultureIgnoreCase ) : bool

Verifies that the source text matches the specified match text using the provided comparison

MaxLength ( this text, int maxLength ) : string

Returns the start of the string up to the specified max length

NotSameAs ( this text, string match, System.StringComparison comparison = StringComparison.InvariantCultureIgnoreCase ) : bool

Verifies that the source text does not equal the specified value using the specified string comparison

RemoveTabs ( this text ) : string

Removes any tab spaces from the source text

SingleLine ( this text ) : string

Removes all line feeds, carriage returns and tab spaces from the source text

SplitLines ( this text, string delimiter = "\r\n" ) : string[]

Split the specified text into lines

StripHTML ( this htmlValue ) : string

Strips all HTML tags from a string

StripHTML ( this htmlValue, string htmlPlaceHolder ) : string

Strips all HTML tags from a string and replaces the tags with the specified replacement

TabsToSpaces ( this text, int spacesPerTab = 16 ) : string

Replaces the tabs in the source text with the specified number of spaces

TitleCase ( this text ) : string

Formats the source text as title case (i.e. "ChristopherJamesFairbairn" would become "Christopher James Fairbairn")

ToArray ( this source ) : string[]

Converts comma delimited string to array

ToArray ( this source, string delimiter ) : string[]

Converts delimited string to array by provided delimiter

ToICIC ( this text, string match ) : bool

Verifies that the source text matches the specified match text using StringComparison.InvariantCultureIgnoreCase

ToList ( this source ) : List

Converts comma delimited items of strings

ToList ( this source, string delimiter ) : List

Converts delimited string to items of strings by provided delimiter

ToUserName ( this source ) : string

Get a users username from a domain name string

Method Details

AsciiToUnicode() public static method

Converts ASCII encoding to Unicode
public static AsciiToUnicode ( this asciiCode ) : string
asciiCode this The ASCII code.
return string

Chop() public static method

Strips the last char from a a string.
public static Chop ( this text ) : string
text this The source string.
return string

Chop() public static method

Strips the last specified chars from a string.
public static Chop ( this text, int removeFromEnd ) : string
text this The source string.
removeFromEnd int The remove from end.
return string

Chop() public static method

Strips the last specified chars from a string.
public static Chop ( this text, string backDownTo ) : string
text this The source string.
backDownTo string The back down to.
return string

Clip() public static method

Strips the last char from a a string.
public static Clip ( this text ) : string
text this The source string.
return string

Clip() public static method

Removes the specified chars from the beginning of a string.
public static Clip ( this text, int removeFromBeginning ) : string
text this The source string.
removeFromBeginning int The remove from beginning.
return string

Clip() public static method

Removes chars from the beginning of a string, up to the specified string
public static Clip ( this text, string removeUpTo ) : string
text this The source string.
removeUpTo string The remove up to.
return string

ContainsCaseInsensitive() public static method

Validate that string contains string case insensitive search
public static ContainsCaseInsensitive ( this text, string contains ) : bool
text this
contains string
return bool

Format() public static method

Formats the source text using the specified parameters
public static Format ( this text ) : string
text this
return string

IsNotNullOrEmpty() public static method

Verifies that the source text is not null or empty
public static IsNotNullOrEmpty ( this text ) : bool
text this
return bool

IsNullOrEmpty() public static method

Verifies that the source text is null or empty
public static IsNullOrEmpty ( this text ) : bool
text this
return bool

IsSameAs() public static method

Verifies that the source text matches the specified match text using the provided comparison
public static IsSameAs ( this text, string match, System.StringComparison comparison = StringComparison.InvariantCultureIgnoreCase ) : bool
text this
match string
comparison System.StringComparison
return bool

MaxLength() public static method

Returns the start of the string up to the specified max length
public static MaxLength ( this text, int maxLength ) : string
text this
maxLength int
return string

NotSameAs() public static method

Verifies that the source text does not equal the specified value using the specified string comparison
public static NotSameAs ( this text, string match, System.StringComparison comparison = StringComparison.InvariantCultureIgnoreCase ) : bool
text this
match string
comparison System.StringComparison
return bool

RemoveTabs() public static method

Removes any tab spaces from the source text
public static RemoveTabs ( this text ) : string
text this
return string

SingleLine() public static method

Removes all line feeds, carriage returns and tab spaces from the source text
public static SingleLine ( this text ) : string
text this
return string

SplitLines() public static method

Split the specified text into lines
public static SplitLines ( this text, string delimiter = "\r\n" ) : string[]
text this
delimiter string
return string[]

StripHTML() public static method

Strips all HTML tags from a string
public static StripHTML ( this htmlValue ) : string
htmlValue this The HTML string.
return string

StripHTML() public static method

Strips all HTML tags from a string and replaces the tags with the specified replacement
public static StripHTML ( this htmlValue, string htmlPlaceHolder ) : string
htmlValue this The HTML string.
htmlPlaceHolder string The HTML place holder.
return string

TabsToSpaces() public static method

Replaces the tabs in the source text with the specified number of spaces
public static TabsToSpaces ( this text, int spacesPerTab = 16 ) : string
text this
spacesPerTab int
return string

TitleCase() public static method

Formats the source text as title case (i.e. "ChristopherJamesFairbairn" would become "Christopher James Fairbairn")
public static TitleCase ( this text ) : string
text this
return string

ToArray() public static method

Converts comma delimited string to array
public static ToArray ( this source ) : string[]
source this
return string[]

ToArray() public static method

Converts delimited string to array by provided delimiter
public static ToArray ( this source, string delimiter ) : string[]
source this
delimiter string
return string[]

ToICIC() public static method

Verifies that the source text matches the specified match text using StringComparison.InvariantCultureIgnoreCase
public static ToICIC ( this text, string match ) : bool
text this
match string
return bool

ToList() public static method

Converts comma delimited items of strings
public static ToList ( this source ) : List
source this
return List

ToList() public static method

Converts delimited string to items of strings by provided delimiter
public static ToList ( this source, string delimiter ) : List
source this
delimiter string
return List

ToUserName() public static method

Get a users username from a domain name string
public static ToUserName ( this source ) : string
source this
return string