C# Класс Utilities.DataTypes.StringExtensions

Показать файл Открыть проект

Открытые методы

Метод Описание
AppendLineFormat ( this Builder, string Format ) : StringBuilder

Does an AppendFormat and then an AppendLine on the StringBuilder

Center ( this Input, int Length, string Padding = " " ) : string

Centers the input string (if it's longer than the length) and pads it using the padding string

Encode ( this Input, Encoding OriginalEncodingUsing = null, Encoding EncodingUsing = null ) : string

Converts a string to a string of another encoding

FromBase64 ( this Input ) : byte[]

Converts base 64 string to a byte array

FromBase64 ( this Input, Encoding EncodingUsing ) : string

Converts base 64 string based on the encoding passed in

Is ( this Value, StringCompare ComparisonType ) : bool

Is this value of the specified type

Is ( this Value1, string Value2, StringCompare ComparisonType ) : bool

Is this value of the specified type

Keep ( this Input, StringFilter Filter ) : string

Removes everything that is not in the filter text from the input.

Keep ( this Input, string Filter ) : string

Removes everything that is not in the filter text from the input.

Left ( this Input, int Length ) : string

Gets the first x number of characters from the left hand side

LevenshteinDistance ( this Value1, string Value2 ) : int

Calculates the Levenshtein distance

MaskLeft ( this Input, int EndPosition = 4, char Mask = '#' ) : string

Masks characters to the left ending at a specific character

MaskRight ( this Input, int StartPosition = 4, char Mask = '#' ) : string

Masks characters to the right starting at a specific character

NumberTimesOccurs ( this Input, string Match ) : int

returns the number of times a string occurs within the text

Pluralize ( this Word, CultureInfo Culture = null ) : string

Pluralizes a word

Remove ( this Input, StringFilter Filter ) : string

Removes everything that is in the filter text from the input.

Remove ( this Input, string Filter ) : string

Removes everything that is in the filter text from the input.

Replace ( this Input, StringFilter Filter, string Value = "" ) : string

Replaces everything that is in the filter text with the value specified.

Reverse ( this Input ) : string

Reverses a string

Right ( this Input, int Length ) : string

Gets the last x number of characters from the right hand side

Singularize ( this Word, CultureInfo Culture = null ) : string

Singularizes a word

StripIllegalXML ( this Content ) : string

Strips illegal characters for XML content

StripLeft ( this Input, string Characters = " " ) : string

Strips out any of the characters specified starting on the left side of the input string (stops when a character not in the list is found)

StripRight ( this Input, string Characters = " " ) : string

Strips out any of the characters specified starting on the right side of the input string (stops when a character not in the list is found)

ToByteArray ( this Input, Encoding EncodingUsing = null ) : byte[]

Converts a string to a byte array

ToString ( this Input ) : string

Formats a string based on the key/value pairs that are sent in

ToString ( this Input, Base64FormattingOptions Options, Encoding OriginalEncodingUsing = null ) : string

Converts from the specified encoding to a base 64 string

ToString ( this Input, StringCase Case ) : string

Formats the string based on the capitalization specified

ToString ( this Input, object Object, string StartSeperator = "{", string EndSeperator = "}" ) : string

Formats a string based on the object's properties

ToString ( this Input, string Format, IStringFormatter Provider = null ) : string

Formats a string based on a format string passed in. The default formatter uses the following format: # = digits @ = alpha characters \ = escape char

ToString ( this Input, string Format, string OutputFormat, RegexOptions Options = RegexOptions.None ) : string

Uses a regex to format the input string

Приватные методы

Метод Описание
BuildFilter ( StringFilter Filter ) : string

Описание методов

AppendLineFormat() публичный статический Метод

Does an AppendFormat and then an AppendLine on the StringBuilder
public static AppendLineFormat ( this Builder, string Format ) : StringBuilder
Builder this Builder object
Format string Format string
Результат StringBuilder

Center() публичный статический Метод

Centers the input string (if it's longer than the length) and pads it using the padding string
public static Center ( this Input, int Length, string Padding = " " ) : string
Input this
Length int
Padding string
Результат string

Encode() публичный статический Метод

Converts a string to a string of another encoding
public static Encode ( this Input, Encoding OriginalEncodingUsing = null, Encoding EncodingUsing = null ) : string
Input this input string
OriginalEncodingUsing System.Text.Encoding /// The type of encoding the string is currently using (defaults to ASCII) ///
EncodingUsing System.Text.Encoding /// The type of encoding the string is converted into (defaults to UTF8) ///
Результат string

FromBase64() публичный статический Метод

Converts base 64 string to a byte array
public static FromBase64 ( this Input ) : byte[]
Input this Input string
Результат byte[]

FromBase64() публичный статический Метод

Converts base 64 string based on the encoding passed in
public static FromBase64 ( this Input, Encoding EncodingUsing ) : string
Input this Input string
EncodingUsing System.Text.Encoding The type of encoding the string is using (defaults to UTF8)
Результат string

Is() публичный статический Метод

Is this value of the specified type
public static Is ( this Value, StringCompare ComparisonType ) : bool
Value this Value to compare
ComparisonType StringCompare Comparison type
Результат bool

Is() публичный статический Метод

Is this value of the specified type
public static Is ( this Value1, string Value2, StringCompare ComparisonType ) : bool
Value1 this Value 1 to compare
Value2 string Value 2 to compare
ComparisonType StringCompare Comparison type
Результат bool

Keep() публичный статический Метод

Removes everything that is not in the filter text from the input.
public static Keep ( this Input, StringFilter Filter ) : string
Input this Input text
Filter StringFilter Predefined filter to use (can be combined as they are flags)
Результат string

Keep() публичный статический Метод

Removes everything that is not in the filter text from the input.
public static Keep ( this Input, string Filter ) : string
Input this Input text
Filter string Regex expression of text to keep
Результат string

Left() публичный статический Метод

Gets the first x number of characters from the left hand side
public static Left ( this Input, int Length ) : string
Input this Input string
Length int x number of characters to return
Результат string

LevenshteinDistance() публичный статический Метод

Calculates the Levenshtein distance
public static LevenshteinDistance ( this Value1, string Value2 ) : int
Value1 this Value 1
Value2 string Value 2
Результат int

MaskLeft() публичный статический Метод

Masks characters to the left ending at a specific character
public static MaskLeft ( this Input, int EndPosition = 4, char Mask = '#' ) : string
Input this Input string
EndPosition int End position (counting from the left)
Mask char Mask character to use
Результат string

MaskRight() публичный статический Метод

Masks characters to the right starting at a specific character
public static MaskRight ( this Input, int StartPosition = 4, char Mask = '#' ) : string
Input this Input string
StartPosition int Start position (counting from the left)
Mask char Mask character to use
Результат string

NumberTimesOccurs() публичный статический Метод

returns the number of times a string occurs within the text
public static NumberTimesOccurs ( this Input, string Match ) : int
Input this input text
Match string The string to match (can be regex)
Результат int

Pluralize() публичный статический Метод

Pluralizes a word
public static Pluralize ( this Word, CultureInfo Culture = null ) : string
Word this Word to pluralize
Culture System.Globalization.CultureInfo /// Culture info used to pluralize the word (defaults to current culture) ///
Результат string

Remove() публичный статический Метод

Removes everything that is in the filter text from the input.
public static Remove ( this Input, StringFilter Filter ) : string
Input this Input text
Filter StringFilter Predefined filter to use (can be combined as they are flags)
Результат string

Remove() публичный статический Метод

Removes everything that is in the filter text from the input.
public static Remove ( this Input, string Filter ) : string
Input this Input text
Filter string Regex expression of text to remove
Результат string

Replace() публичный статический Метод

Replaces everything that is in the filter text with the value specified.
public static Replace ( this Input, StringFilter Filter, string Value = "" ) : string
Input this Input text
Filter StringFilter Predefined filter to use (can be combined as they are flags)
Value string Value to fill in
Результат string

Reverse() публичный статический Метод

Reverses a string
public static Reverse ( this Input ) : string
Input this Input string
Результат string

Right() публичный статический Метод

Gets the last x number of characters from the right hand side
public static Right ( this Input, int Length ) : string
Input this Input string
Length int x number of characters to return
Результат string

Singularize() публичный статический Метод

Singularizes a word
public static Singularize ( this Word, CultureInfo Culture = null ) : string
Word this Word to singularize
Culture System.Globalization.CultureInfo /// Culture info used to singularize the word (defaults to current culture) ///
Результат string

StripIllegalXML() публичный статический Метод

Strips illegal characters for XML content
public static StripIllegalXML ( this Content ) : string
Content this Content
Результат string

StripLeft() публичный статический Метод

Strips out any of the characters specified starting on the left side of the input string (stops when a character not in the list is found)
public static StripLeft ( this Input, string Characters = " " ) : string
Input this Input string
Characters string Characters to strip (defaults to a space)
Результат string

StripRight() публичный статический Метод

Strips out any of the characters specified starting on the right side of the input string (stops when a character not in the list is found)
public static StripRight ( this Input, string Characters = " " ) : string
Input this Input string
Characters string Characters to strip (defaults to a space)
Результат string

ToByteArray() публичный статический Метод

Converts a string to a byte array
public static ToByteArray ( this Input, Encoding EncodingUsing = null ) : byte[]
Input this input string
EncodingUsing System.Text.Encoding The type of encoding the string is using (defaults to UTF8)
Результат byte[]

ToString() публичный статический Метод

Formats a string based on the key/value pairs that are sent in
public static ToString ( this Input ) : string
Input this Input string
Результат string

ToString() публичный статический Метод

Converts from the specified encoding to a base 64 string
public static ToString ( this Input, Base64FormattingOptions Options, Encoding OriginalEncodingUsing = null ) : string
Input this Input string
Options Base64FormattingOptions Base 64 formatting options
OriginalEncodingUsing System.Text.Encoding /// The type of encoding the string is using (defaults to UTF8) ///
Результат string

ToString() публичный статический Метод

Formats the string based on the capitalization specified
public static ToString ( this Input, StringCase Case ) : string
Input this Input string
Case StringCase Capitalization type to use
Результат string

ToString() публичный статический Метод

Formats a string based on the object's properties
public static ToString ( this Input, object Object, string StartSeperator = "{", string EndSeperator = "}" ) : string
Input this Input string
Object object Object to use to format the string
StartSeperator string /// Seperator character/string to use to describe the start of the property name ///
EndSeperator string /// Seperator character/string to use to describe the end of the property name ///
Результат string

ToString() публичный статический Метод

Formats a string based on a format string passed in. The default formatter uses the following format: # = digits @ = alpha characters \ = escape char
public static ToString ( this Input, string Format, IStringFormatter Provider = null ) : string
Input this Input string
Format string Format of the output string
Provider IStringFormatter String formatter provider (defaults to GenericStringFormatter)
Результат string

ToString() публичный статический Метод

Uses a regex to format the input string
public static ToString ( this Input, string Format, string OutputFormat, RegexOptions Options = RegexOptions.None ) : string
Input this Input string
Format string Regex string used to
OutputFormat string Output format
Options RegexOptions Regex options
Результат string