C# 클래스 ClrPlus.Core.Extensions.StringExtensions

Extensions for strings. Whheeee
파일 보기 프로젝트 열기: perpetual-motion/clrplus

공개 메소드들

메소드 설명
CamelCaseToDashed ( this camelCaseText, char separator = '-' ) : string
Contains ( this text ) : bool
ContainsAllAsWildcards ( this source ) : bool
ContainsAnyAsWildcards ( this source ) : bool
ContainsIgnoreCase ( this source, string value ) : bool

A case insensitive Contains() method.

CreateGuid ( this str ) : System.Guid

Creates a GUID from an MD5 value of the string passed in.

CreatePublicKeyToken ( this publicKey ) : string

Creates the public key token given a public key.. Note: Does this work?

DashedToCamelCase ( this dashedText, char separator = '-' ) : string
DashedToPascalCase ( this dashedText, char separator = '-' ) : string
EmptyAsNull ( this str ) : string
EqualsEx ( this str1, string str2 ) : bool

Checks to see if strings are equal, with empty strings being considered equal to null.

Error ( this formatString ) : void

Errors the specified format string.

FormatWithMacros ( this value, GetMacroValueDelegate getMacroValue, object eachItem = null, GetMacroValueDelegate preprocessValue = null, GetMacroValueDelegate postprocessValue = null ) : string
GetKeyTokenFromFullKey ( this fullKey ) : byte[]

Gets the key token from full key. Does this work?

Gunzip ( this input ) : string

Gunzips the specified input.

GunzipFromBase64 ( this input ) : string

Gunzips from base64.

Gzip ( this input ) : byte[]

Gzips the specified input.

GzipToBase64 ( this input ) : string

Gzips to base64.

HasWildcardMatch ( this source, string value, string ignorePrefix = null ) : bool

Runs IsWildcardMatch on a collection.

HasWildcards ( this input ) : bool

Determines whether the specified input has wildcards.

HtmlDecode ( this s ) : string

decodes an HTML encoded string

HtmlEncode ( this s ) : string

Encodes a string into HTML encoding format, encoding control characters as well.

IfNullOrEmpty ( this text, string defaultText ) : string
Is ( this str ) : bool
IsBoolean ( this text ) : bool

Determines whether the specified text is a boolean (true or false).

IsEmail ( this email ) : bool

Determines whether the specified email is email.

IsFalse ( this text ) : bool

Determines whether the specified text is equal to "false" (ignoring case).

IsMultiline ( this text ) : bool
IsNegative ( this text ) : bool

Determines whether the specified text is equal to some value indicated negative/off/false/no (ignoring case).

IsPositive ( this text ) : bool

Determines whether the specified text equal to some value indicated on/true/enabled (ignoring case).

IsTrue ( this text ) : bool

Determines whether the specified text equal to "true" (ignoring case).

IsWebUri ( this text ) : bool
MD5Hash ( this input ) : string

Calculates the MD5 hash of a string. Additionally all the letters in the hash are in uppercase.

MakeAttractiveFilename ( this input ) : string
MakeSafeDirectoryId ( this input ) : string

Creates a safe directory ID for MSI for a possibly non-safe one.

MakeSafeFileName ( this input ) : string
Match ( this input, string rxExpression ) : Match

Matches the specified input.

MatchIgnoreCase ( this input, string rxExpression ) : Match

Matches a regular expression, ignoring case.

NewIsWildcardMatch ( this text, string wildcardMask, bool isMatchingLocation = false, string currentLocation = null ) : bool

The new implementation of the wildcard matching function. Rules: * means matches anything except slash or backslash ? means match any one character ** means matches anything

OnlyContains ( this str, char characters ) : bool

returns true when the string contains only the characters passed in.

OnlyContains ( this str, string characters ) : bool

returns true when the string contains only the characters in the string passed in .

PositionOfFirstCharacterNotIn ( this str, char characters ) : int

Gets the position of the first character that is not in the collection of characters passed in.

PositionOfFirstCharacterNotIn ( this str, string characters ) : int

Gets the position of the first character that is not in the string passed in.

ProtectBinaryForMachine ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable

encrypts the given collection of bytes with the machine key and salt (defaults to "CoAppToolkit")

ProtectBinaryForUser ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable

encrypts the given collection of bytes with the user key and salt (defaults to "CoAppToolkit")

ProtectForMachine ( this text, string salt = "CoAppToolkit" ) : IEnumerable

encrypts the given string with the machine key and salt (defaults to "CoAppToolkit")

ProtectForUser ( this text, string salt = "CoAppToolkit" ) : IEnumerable

encrypts the given string with the machine key and salt (defaults to "CoAppToolkit")

Replace ( this s, string oldValue, string newValue, System.StringComparison comparisonType ) : string

Case insensitive version of String.Replace().

StartsWithNumber ( this str ) : bool
ToByteArray ( this text ) : byte[]

Encodes the string as an array of UTF8 bytes.

ToHexString ( this bytes ) : string

Creates a hex representaion of a collection of bytes

ToInt32 ( this str ) : int

coerces a string to an int32, defaults to zero.

ToInt32 ( this str, int defaultValue ) : int

coerces a string to an int32, defaults to zero.

ToSecureString ( this password ) : SecureString
ToUnsecureString ( this securePassword ) : string
ToUri ( this stringUri ) : Uri
ToUtf8String ( this bytes ) : string

Creates a string from a collection of UTF8 bytes

UnprotectBinaryForMachine ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable

decrypts the given collection of bytes with the machine key and salt (defaults to "CoAppToolkit") returns an empty collection of bytes on failure

UnprotectBinaryForUser ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable

decrypts the given collection of bytes with the user key and salt (defaults to "CoAppToolkit") returns an empty collection of bytes on failure

UnprotectForMachine ( this binaryData, string salt = "CoAppToolkit" ) : string

decrypts the given collection of bytes with the machine key and salt (defaults to "CoAppToolkit") and returns a string from the UTF8 representation of the bytes. returns an empty string on failure

UnprotectForUser ( this binaryData, string salt = "CoAppToolkit" ) : string

decrypts the given collection of bytes with the user key and salt (defaults to "CoAppToolkit") and returns a string from the UTF8 representation of the bytes. returns an empty string on failure

UrlDecode ( this s ) : string

decodes the URL encoded string

UrlEncode ( this s ) : string

encodes the string as a url encoded string

UrlEncodeJustBackslashes ( this s ) : string
WhenNullOrEmpty ( this original, string whenEmpty ) : string
format ( this formatString ) : string

Formats the specified format string.

비공개 메소드들

메소드 설명
ProcessMacroInternal ( this value, GetMacroValueDelegate getMacroValue, object eachItem = null ) : string
WildcardToRegex ( string wildcard, string noEscapePrefix = "^" ) : Regex
camelCaseToDashed ( this camelCaseText, char separator = '-' ) : IEnumerable
dashedToCamelCase ( this dashedText, char separator = '-', bool pascalCase = false ) : IEnumerable

메소드 상세

CamelCaseToDashed() 공개 정적인 메소드

public static CamelCaseToDashed ( this camelCaseText, char separator = '-' ) : string
camelCaseText this
separator char
리턴 string

Contains() 공개 정적인 메소드

public static Contains ( this text ) : bool
text this
리턴 bool

ContainsAllAsWildcards() 공개 정적인 메소드

public static ContainsAllAsWildcards ( this source ) : bool
source this
리턴 bool

ContainsAnyAsWildcards() 공개 정적인 메소드

public static ContainsAnyAsWildcards ( this source ) : bool
source this
리턴 bool

ContainsIgnoreCase() 공개 정적인 메소드

A case insensitive Contains() method.
public static ContainsIgnoreCase ( this source, string value ) : bool
source this The source.
value string The value.
리턴 bool

CreateGuid() 공개 정적인 메소드

Creates a GUID from an MD5 value of the string passed in.
public static CreateGuid ( this str ) : System.Guid
str this The STR.
리턴 System.Guid

CreatePublicKeyToken() 공개 정적인 메소드

Creates the public key token given a public key.. Note: Does this work?
public static CreatePublicKeyToken ( this publicKey ) : string
publicKey this The public key.
리턴 string

DashedToCamelCase() 공개 정적인 메소드

public static DashedToCamelCase ( this dashedText, char separator = '-' ) : string
dashedText this
separator char
리턴 string

DashedToPascalCase() 공개 정적인 메소드

public static DashedToPascalCase ( this dashedText, char separator = '-' ) : string
dashedText this
separator char
리턴 string

EmptyAsNull() 공개 정적인 메소드

public static EmptyAsNull ( this str ) : string
str this
리턴 string

EqualsEx() 공개 정적인 메소드

Checks to see if strings are equal, with empty strings being considered equal to null.
public static EqualsEx ( this str1, string str2 ) : bool
str1 this First String to compare
str2 string Second String to compare
리턴 bool

Error() 공개 정적인 메소드

Errors the specified format string.
public static Error ( this formatString ) : void
formatString this The format string.
리턴 void

FormatWithMacros() 공개 정적인 메소드

public static FormatWithMacros ( this value, GetMacroValueDelegate getMacroValue, object eachItem = null, GetMacroValueDelegate preprocessValue = null, GetMacroValueDelegate postprocessValue = null ) : string
value this
getMacroValue GetMacroValueDelegate
eachItem object
preprocessValue GetMacroValueDelegate
postprocessValue GetMacroValueDelegate
리턴 string

GetKeyTokenFromFullKey() 공개 정적인 메소드

Gets the key token from full key. Does this work?
public static GetKeyTokenFromFullKey ( this fullKey ) : byte[]
fullKey this The full key.
리턴 byte[]

Gunzip() 공개 정적인 메소드

Gunzips the specified input.
public static Gunzip ( this input ) : string
input this The input.
리턴 string

GunzipFromBase64() 공개 정적인 메소드

Gunzips from base64.
public static GunzipFromBase64 ( this input ) : string
input this The input.
리턴 string

Gzip() 공개 정적인 메소드

Gzips the specified input.
public static Gzip ( this input ) : byte[]
input this The input.
리턴 byte[]

GzipToBase64() 공개 정적인 메소드

Gzips to base64.
public static GzipToBase64 ( this input ) : string
input this The input.
리턴 string

HasWildcardMatch() 공개 정적인 메소드

Runs IsWildcardMatch on a collection.
public static HasWildcardMatch ( this source, string value, string ignorePrefix = null ) : bool
source this The source.
value string The value.
ignorePrefix string The ignore prefix.
리턴 bool

HasWildcards() 공개 정적인 메소드

Determines whether the specified input has wildcards.
public static HasWildcards ( this input ) : bool
input this The input.
리턴 bool

HtmlDecode() 공개 정적인 메소드

decodes an HTML encoded string
public static HtmlDecode ( this s ) : string
s this The string
리턴 string

HtmlEncode() 공개 정적인 메소드

Encodes a string into HTML encoding format, encoding control characters as well.
public static HtmlEncode ( this s ) : string
s this The s.
리턴 string

IfNullOrEmpty() 공개 정적인 메소드

public static IfNullOrEmpty ( this text, string defaultText ) : string
text this
defaultText string
리턴 string

Is() 공개 정적인 메소드

public static Is ( this str ) : bool
str this
리턴 bool

IsBoolean() 공개 정적인 메소드

Determines whether the specified text is a boolean (true or false).
public static IsBoolean ( this text ) : bool
text this The text.
리턴 bool

IsEmail() 공개 정적인 메소드

Determines whether the specified email is email.
public static IsEmail ( this email ) : bool
email this The email.
리턴 bool

IsFalse() 공개 정적인 메소드

Determines whether the specified text is equal to "false" (ignoring case).
public static IsFalse ( this text ) : bool
text this The text.
리턴 bool

IsMultiline() 공개 정적인 메소드

public static IsMultiline ( this text ) : bool
text this
리턴 bool

IsNegative() 공개 정적인 메소드

Determines whether the specified text is equal to some value indicated negative/off/false/no (ignoring case).
public static IsNegative ( this text ) : bool
text this The text.
리턴 bool

IsPositive() 공개 정적인 메소드

Determines whether the specified text equal to some value indicated on/true/enabled (ignoring case).
public static IsPositive ( this text ) : bool
text this The text.
리턴 bool

IsTrue() 공개 정적인 메소드

Determines whether the specified text equal to "true" (ignoring case).
public static IsTrue ( this text ) : bool
text this The text.
리턴 bool

IsWebUri() 공개 정적인 메소드

public static IsWebUri ( this text ) : bool
text this
리턴 bool

MD5Hash() 공개 정적인 메소드

Calculates the MD5 hash of a string. Additionally all the letters in the hash are in uppercase.
public static MD5Hash ( this input ) : string
input this a string to a calculate the hash for
리턴 string

MakeAttractiveFilename() 공개 정적인 메소드

public static MakeAttractiveFilename ( this input ) : string
input this
리턴 string

MakeSafeDirectoryId() 공개 정적인 메소드

Creates a safe directory ID for MSI for a possibly non-safe one.
public static MakeSafeDirectoryId ( this input ) : string
input this The input.
리턴 string

MakeSafeFileName() 공개 정적인 메소드

public static MakeSafeFileName ( this input ) : string
input this
리턴 string

Match() 공개 정적인 메소드

Matches the specified input.
public static Match ( this input, string rxExpression ) : Match
input this The input.
rxExpression string The rx expression.
리턴 System.Text.RegularExpressions.Match

MatchIgnoreCase() 공개 정적인 메소드

Matches a regular expression, ignoring case.
public static MatchIgnoreCase ( this input, string rxExpression ) : Match
input this The input.
rxExpression string The rx expression.
리턴 System.Text.RegularExpressions.Match

NewIsWildcardMatch() 공개 정적인 메소드

The new implementation of the wildcard matching function. Rules: * means matches anything except slash or backslash ? means match any one character ** means matches anything
public static NewIsWildcardMatch ( this text, string wildcardMask, bool isMatchingLocation = false, string currentLocation = null ) : bool
text this
wildcardMask string
isMatchingLocation bool
currentLocation string
리턴 bool

OnlyContains() 공개 정적인 메소드

returns true when the string contains only the characters passed in.
public static OnlyContains ( this str, char characters ) : bool
str this The STR.
characters char The characters.
리턴 bool

OnlyContains() 공개 정적인 메소드

returns true when the string contains only the characters in the string passed in .
public static OnlyContains ( this str, string characters ) : bool
str this The STR.
characters string The characters.
리턴 bool

PositionOfFirstCharacterNotIn() 공개 정적인 메소드

Gets the position of the first character that is not in the collection of characters passed in.
public static PositionOfFirstCharacterNotIn ( this str, char characters ) : int
str this The STR.
characters char The characters.
리턴 int

PositionOfFirstCharacterNotIn() 공개 정적인 메소드

Gets the position of the first character that is not in the string passed in.
public static PositionOfFirstCharacterNotIn ( this str, string characters ) : int
str this The STR.
characters string The characters.
리턴 int

ProtectBinaryForMachine() 공개 정적인 메소드

encrypts the given collection of bytes with the machine key and salt (defaults to "CoAppToolkit")
public static ProtectBinaryForMachine ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable
binaryData this The binary data.
salt string The salt.
리턴 IEnumerable

ProtectBinaryForUser() 공개 정적인 메소드

encrypts the given collection of bytes with the user key and salt (defaults to "CoAppToolkit")
public static ProtectBinaryForUser ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable
binaryData this The binary data.
salt string The salt.
리턴 IEnumerable

ProtectForMachine() 공개 정적인 메소드

encrypts the given string with the machine key and salt (defaults to "CoAppToolkit")
public static ProtectForMachine ( this text, string salt = "CoAppToolkit" ) : IEnumerable
text this The text.
salt string The salt.
리턴 IEnumerable

ProtectForUser() 공개 정적인 메소드

encrypts the given string with the machine key and salt (defaults to "CoAppToolkit")
public static ProtectForUser ( this text, string salt = "CoAppToolkit" ) : IEnumerable
text this The text.
salt string The salt.
리턴 IEnumerable

Replace() 공개 정적인 메소드

Case insensitive version of String.Replace().
public static Replace ( this s, string oldValue, string newValue, System.StringComparison comparisonType ) : string
s this String that contains patterns to replace
oldValue string Pattern to find
newValue string New pattern to replaces old
comparisonType System.StringComparison String comparison type
리턴 string

StartsWithNumber() 공개 정적인 메소드

public static StartsWithNumber ( this str ) : bool
str this
리턴 bool

ToByteArray() 공개 정적인 메소드

Encodes the string as an array of UTF8 bytes.
public static ToByteArray ( this text ) : byte[]
text this The text.
리턴 byte[]

ToHexString() 공개 정적인 메소드

Creates a hex representaion of a collection of bytes
public static ToHexString ( this bytes ) : string
bytes this The bytes.
리턴 string

ToInt32() 공개 정적인 메소드

coerces a string to an int32, defaults to zero.
public static ToInt32 ( this str ) : int
str this The STR.
리턴 int

ToInt32() 공개 정적인 메소드

coerces a string to an int32, defaults to zero.
public static ToInt32 ( this str, int defaultValue ) : int
str this The STR.
defaultValue int The default value if the string isn't a valid int.
리턴 int

ToSecureString() 공개 정적인 메소드

public static ToSecureString ( this password ) : SecureString
password this
리턴 System.Security.SecureString

ToUnsecureString() 공개 정적인 메소드

public static ToUnsecureString ( this securePassword ) : string
securePassword this
리턴 string

ToUri() 공개 정적인 메소드

public static ToUri ( this stringUri ) : Uri
stringUri this
리턴 System.Uri

ToUtf8String() 공개 정적인 메소드

Creates a string from a collection of UTF8 bytes
public static ToUtf8String ( this bytes ) : string
bytes this The bytes.
리턴 string

UnprotectBinaryForMachine() 공개 정적인 메소드

decrypts the given collection of bytes with the machine key and salt (defaults to "CoAppToolkit") returns an empty collection of bytes on failure
public static UnprotectBinaryForMachine ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable
binaryData this The binary data.
salt string The salt.
리턴 IEnumerable

UnprotectBinaryForUser() 공개 정적인 메소드

decrypts the given collection of bytes with the user key and salt (defaults to "CoAppToolkit") returns an empty collection of bytes on failure
public static UnprotectBinaryForUser ( this binaryData, string salt = "CoAppToolkit" ) : IEnumerable
binaryData this The binary data.
salt string The salt.
리턴 IEnumerable

UnprotectForMachine() 공개 정적인 메소드

decrypts the given collection of bytes with the machine key and salt (defaults to "CoAppToolkit") and returns a string from the UTF8 representation of the bytes. returns an empty string on failure
public static UnprotectForMachine ( this binaryData, string salt = "CoAppToolkit" ) : string
binaryData this The binary data.
salt string The salt.
리턴 string

UnprotectForUser() 공개 정적인 메소드

decrypts the given collection of bytes with the user key and salt (defaults to "CoAppToolkit") and returns a string from the UTF8 representation of the bytes. returns an empty string on failure
public static UnprotectForUser ( this binaryData, string salt = "CoAppToolkit" ) : string
binaryData this The binary data.
salt string The salt.
리턴 string

UrlDecode() 공개 정적인 메소드

decodes the URL encoded string
public static UrlDecode ( this s ) : string
s this The s.
리턴 string

UrlEncode() 공개 정적인 메소드

encodes the string as a url encoded string
public static UrlEncode ( this s ) : string
s this The s.
리턴 string

UrlEncodeJustBackslashes() 공개 정적인 메소드

public static UrlEncodeJustBackslashes ( this s ) : string
s this
리턴 string

WhenNullOrEmpty() 공개 정적인 메소드

public static WhenNullOrEmpty ( this original, string whenEmpty ) : string
original this
whenEmpty string
리턴 string

format() 공개 정적인 메소드

Formats the specified format string.
public static format ( this formatString ) : string
formatString this The format string.
리턴 string