C# 클래스 Yea.DataTypes.ExtensionMethods.StringExtensions

String and StringBuilder extensions
파일 보기 프로젝트 열기: OxPatient/Rule-Engine

공개 메소드들

메소드 설명
AlphaCharactersOnly ( this input ) : string

Keeps only alpha characters

AlphaNumericOnly ( this input ) : string

Keeps only alphanumeric characters

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

ExpandTabs ( this input, int tabSize = 4 ) : string

Expands tabs and replaces them with spaces

FilterOutText ( this input, string filter ) : string

Removes the filter text from the input.

FormatString ( this input ) : string

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

FormatString ( this input, object Object, string startSeperator = "{", string endSeperator = "}" ) : string

Formats a string based on the object's properties

FormatString ( 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

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

IsAnagram ( this input1, string input2 ) : bool

Determines if the two strings are anagrams or not

IsCreditCard ( this creditCardNumber ) : bool

Checks if a credit card number is valid

IsUnicode ( this input ) : bool

Determines if a string is unicode

KeepFilterText ( 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

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

NextSequence ( this sequence, char min = ' ', char max = '~' ) : string

Function that is useful for generating a string in a series. so a becomes b, b becomes c, etc. and after hitting the max character, it goes to two characters (so ~ becomes aa, then ab, ac, etc).

NumberTimesOccurs ( this input, string match ) : int

returns the number of times a string occurs within the text

NumericOnly ( this input, bool keepNumericPunctuation = true ) : string

Keeps only numeric characters

Pluralize ( this word, CultureInfo culture = null ) : string

Pluralizes a word

RegexFormat ( this input, string format, string outputFormat, RegexOptions options = RegexOptions.None ) : string

Uses a regex to format the input string

RemoveExtraSpaces ( this input ) : string

Removes multiple spaces from a string and replaces it with a single space

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)

ToBase64 ( this input, Encoding originalEncodingUsing = null ) : string

Converts from the specified encoding to a base 64 string

ToByteArray ( this input, Encoding encodingUsing = null ) : byte[]

Converts a string to a byte array

ToFirstCharacterUpperCase ( this input ) : string

Takes the first character of an input string and makes it uppercase

ToSentenceCapitalize ( this input ) : string

Capitalizes each sentence within the string

ToTitleCase ( this input ) : string

Capitalizes the first character of each word

비공개 메소드들

메소드 설명
LevenshteinDistance ( this value1, string value2 ) : int

메소드 상세

AlphaCharactersOnly() 공개 정적인 메소드

Keeps only alpha characters
public static AlphaCharactersOnly ( this input ) : string
input this Input string
리턴 string

AlphaNumericOnly() 공개 정적인 메소드

Keeps only alphanumeric characters
public static AlphaNumericOnly ( this input ) : string
input this Input string
리턴 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

ExpandTabs() 공개 정적인 메소드

Expands tabs and replaces them with spaces
public static ExpandTabs ( this input, int tabSize = 4 ) : string
input this Input string
tabSize int Number of spaces
리턴 string

FilterOutText() 공개 정적인 메소드

Removes the filter text from the input.
public static FilterOutText ( this input, string filter ) : string
input this Input text
filter string Regex expression of text to filter out
리턴 string

FormatString() 공개 정적인 메소드

Formats a string based on the key/value pairs that are sent in
public static FormatString ( this input ) : string
input this Input string
리턴 string

FormatString() 공개 정적인 메소드

Formats a string based on the object's properties
public static FormatString ( 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

FormatString() 공개 정적인 메소드

Formats a string based on a format string passed in. The default formatter uses the following format: # = digits @ = alpha characters \ = escape char
public static FormatString ( 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

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

IsAnagram() 공개 정적인 메소드

Determines if the two strings are anagrams or not
public static IsAnagram ( this input1, string input2 ) : bool
input1 this Input 1
input2 string Input 2
리턴 bool

IsCreditCard() 공개 정적인 메소드

Checks if a credit card number is valid
public static IsCreditCard ( this creditCardNumber ) : bool
creditCardNumber this Number to check
리턴 bool

IsUnicode() 공개 정적인 메소드

Determines if a string is unicode
public static IsUnicode ( this input ) : bool
input this Input string
리턴 bool

KeepFilterText() 공개 정적인 메소드

Removes everything that is not in the filter text from the input.
public static KeepFilterText ( 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

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

NextSequence() 공개 정적인 메소드

Function that is useful for generating a string in a series. so a becomes b, b becomes c, etc. and after hitting the max character, it goes to two characters (so ~ becomes aa, then ab, ac, etc).
public static NextSequence ( this sequence, char min = ' ', char max = '~' ) : string
sequence this Current sequence
min char Min character
max char Max character
리턴 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

NumericOnly() 공개 정적인 메소드

Keeps only numeric characters
public static NumericOnly ( this input, bool keepNumericPunctuation = true ) : string
input this Input string
keepNumericPunctuation bool Determines if decimal places should be kept
리턴 string

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

RegexFormat() 공개 정적인 메소드

Uses a regex to format the input string
public static RegexFormat ( 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

RemoveExtraSpaces() 공개 정적인 메소드

Removes multiple spaces from a string and replaces it with a single space
public static RemoveExtraSpaces ( this input ) : string
input this Input string
리턴 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 string (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 string (defaults to a space)
리턴 string

ToBase64() 공개 정적인 메소드

Converts from the specified encoding to a base 64 string
public static ToBase64 ( this input, Encoding originalEncodingUsing = null ) : string
input this Input string
originalEncodingUsing System.Text.Encoding The type of encoding the string is using (defaults to UTF8)
리턴 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[]

ToFirstCharacterUpperCase() 공개 정적인 메소드

Takes the first character of an input string and makes it uppercase
public static ToFirstCharacterUpperCase ( this input ) : string
input this Input string
리턴 string

ToSentenceCapitalize() 공개 정적인 메소드

Capitalizes each sentence within the string
public static ToSentenceCapitalize ( this input ) : string
input this Input string
리턴 string

ToTitleCase() 공개 정적인 메소드

Capitalizes the first character of each word
public static ToTitleCase ( this input ) : string
input this Input string
리턴 string