C# 클래스 Icing.StringExtensions

String extensions.
파일 보기 프로젝트 열기: benallred/Icing

공개 메소드들

메소드 설명
DoesNotEndWith ( this source, string value ) : bool

Determines whether the end of this string instance does not match the specified string.

EnsureEndsWith ( this source, string value ) : string

Returns the current string instance with the specified value appended, if the current string instance does not already end with the specified value.

Format ( this source, string>.IDictionary replacements ) : string

Returns a new string in which all occurrences of the specified tokens in the current instance are replaced with the provided replacement values.

A token is designated in a string by surrounding it with curly braces (example: {MyToken}).

A token must consist of one or more valid "word characters" (think valid variable name) and is case-sensitive.

Curly braces can be escaped by using double braces. The double braces will be replaced with single braces (example: "{{something}}" becomes "{something}").

Any token without a replacement value specified will be untouched and appear in the returned string exactly as in the source.

Format ( this source, object replacements ) : string

Returns a new string in which all occurrences of the specified tokens in the current instance are replaced with the provided replacement values.

A token is designated in a string by surrounding it with curly braces (example: {MyToken}).

A token must consist of one or more valid "word characters" (think valid variable name) and is case-sensitive.

Curly braces can be escaped by using double braces. The double braces will be replaced with single braces (example: "{{something}}" becomes "{something}").

Any token without a replacement value specified will be untouched and appear in the returned string exactly as in the source.

IsNotNullOrEmpty ( this source ) : bool

Indicates whether the current string is not null and not an System.String.Empty string.

IsNotNullOrWhiteSpace ( this source ) : bool

Indicates whether the current string is not null, not empty, and does not consist only of white-space characters.

IsNullOrEmpty ( this source ) : bool

Indicates whether the current string is null or an System.String.Empty string.

IsNullOrWhiteSpace ( this source ) : bool

Indicates whether the current string is null, empty, or consists only of white-space characters.

PadNumber ( this source, int maxNumberToMatch, char paddingChar = '0' ) : string

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a total length equal to that of the length of the maximum number to match.

PadNumber ( this source, long maxNumberToMatch, char paddingChar = '0' ) : string

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a total length equal to that of the length of the maximum number to match.

PadNumber ( this source, uint maxNumberToMatch, char paddingChar = '0' ) : string

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a total length equal to that of the length of the maximum number to match.

Reverse ( this source ) : string

Reverses the sequence of the characters in the entire string.

ToInt32 ( this source ) : int

Converts the current string representation of a number to its 32-bit signed integer equivalent.

Trim ( this source, string trim ) : string

Removes all leading and trailing occurrences of the given string from the current String object.

메소드 상세

DoesNotEndWith() 공개 정적인 메소드

Determines whether the end of this string instance does not match the specified string.
public static DoesNotEndWith ( this source, string value ) : bool
source this The string to test.
value string The string to compare to the substring at the end of this instance.
리턴 bool

EnsureEndsWith() 공개 정적인 메소드

Returns the current string instance with the specified value appended, if the current string instance does not already end with the specified value.
public static EnsureEndsWith ( this source, string value ) : string
source this The source string.
value string The value to append.
리턴 string

Format() 공개 정적인 메소드

Returns a new string in which all occurrences of the specified tokens in the current instance are replaced with the provided replacement values.

A token is designated in a string by surrounding it with curly braces (example: {MyToken}).

A token must consist of one or more valid "word characters" (think valid variable name) and is case-sensitive.

Curly braces can be escaped by using double braces. The double braces will be replaced with single braces (example: "{{something}}" becomes "{something}").

Any token without a replacement value specified will be untouched and appear in the returned string exactly as in the source.

public static Format ( this source, string>.IDictionary replacements ) : string
source this The source string.
replacements string>.IDictionary The replacement values.
리턴 string

Format() 공개 정적인 메소드

Returns a new string in which all occurrences of the specified tokens in the current instance are replaced with the provided replacement values.

A token is designated in a string by surrounding it with curly braces (example: {MyToken}).

A token must consist of one or more valid "word characters" (think valid variable name) and is case-sensitive.

Curly braces can be escaped by using double braces. The double braces will be replaced with single braces (example: "{{something}}" becomes "{something}").

Any token without a replacement value specified will be untouched and appear in the returned string exactly as in the source.

public static Format ( this source, object replacements ) : string
source this The source string.
replacements object The replacement values - must be an anonymous type.
리턴 string

IsNotNullOrEmpty() 공개 정적인 메소드

Indicates whether the current string is not null and not an System.String.Empty string.
public static IsNotNullOrEmpty ( this source ) : bool
source this The string to test.
리턴 bool

IsNotNullOrWhiteSpace() 공개 정적인 메소드

Indicates whether the current string is not null, not empty, and does not consist only of white-space characters.
public static IsNotNullOrWhiteSpace ( this source ) : bool
source this The string to test.
리턴 bool

IsNullOrEmpty() 공개 정적인 메소드

Indicates whether the current string is null or an System.String.Empty string.
public static IsNullOrEmpty ( this source ) : bool
source this The string to test.
리턴 bool

IsNullOrWhiteSpace() 공개 정적인 메소드

Indicates whether the current string is null, empty, or consists only of white-space characters.
public static IsNullOrWhiteSpace ( this source ) : bool
source this The string to test.
리턴 bool

PadNumber() 공개 정적인 메소드

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a total length equal to that of the length of the maximum number to match.
is less than zero.
public static PadNumber ( this source, int maxNumberToMatch, char paddingChar = '0' ) : string
source this The source.
maxNumberToMatch int The maximum number to match.
paddingChar char A Unicode padding character.
리턴 string

PadNumber() 공개 정적인 메소드

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a total length equal to that of the length of the maximum number to match.
is less than zero.
public static PadNumber ( this source, long maxNumberToMatch, char paddingChar = '0' ) : string
source this The source.
maxNumberToMatch long The maximum number to match.
paddingChar char A Unicode padding character.
리턴 string

PadNumber() 공개 정적인 메소드

Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified Unicode character, for a total length equal to that of the length of the maximum number to match.
public static PadNumber ( this source, uint maxNumberToMatch, char paddingChar = '0' ) : string
source this The source.
maxNumberToMatch uint The maximum number to match.
paddingChar char A Unicode padding character.
리턴 string

Reverse() 공개 정적인 메소드

Reverses the sequence of the characters in the entire string.
is null.
public static Reverse ( this source ) : string
source this The source.
리턴 string

ToInt32() 공개 정적인 메소드

Converts the current string representation of a number to its 32-bit signed integer equivalent.
is null. is not in the correct format. represents a number less than or greater than .
public static ToInt32 ( this source ) : int
source this The source containing a number to convert.
리턴 int

Trim() 공개 정적인 메소드

Removes all leading and trailing occurrences of the given string from the current String object.
is null or empty.
public static Trim ( this source, string trim ) : string
source this The source.
trim string The string to remove.
리턴 string