C# 클래스 Utilities.DataTypes.StringExtensions

파일 보기 프로젝트 열기: JaCraig/Craig-s-Utility-Library

공개 메소드들

메소드 설명
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