C# Class Loyc.StringBuilderExt

Extension methods that add some functionality of string to StringBuilder.
Mostrar archivo Open project: qwertie/ecsharp

Public Methods

Method Description
AppendCodePoint ( this s, int c ) : StringBuilder

Appends a unicode code point in the range 0 to 0x10FFFF to StringBuilder in UTF-16.

EndsWith ( this sb, UString what, bool ignoreCase = false ) : bool

Finds out whether the StringBuilder ends with the specified substring.

IndexOf ( this sb, UString searchStr, int startIndex, bool ignoreCase = false ) : int

Gets the index of a substring in a StringBuilder

IndexOf ( this sb, char value, int startIndex ) : int

Gets the index of a character in a StringBuilder

Last ( this str ) : char

Returns the last character of the string

LastIndexOf ( this sb, UString searchStr, int startIndex = int.MaxValue, bool ignoreCase = false ) : int

Gets the index of a substring in a StringBuilder

LastIndexOf ( this sb, char searchChar, int startIndex = int.MaxValue ) : int

Gets the index of a character in a StringBuilder

LastOrDefault ( this str, char @default = '\0' ) : char

Returns the last character of the string, or a default character if the string is empty.

StartsWith ( this sb, UString what, bool ignoreCase = false ) : bool

Finds out whether the StringBuilder starts with the specified substring.

Substring ( this sb, int startIndex, int length ) : string

Extracts a substring from the specified StringBuiler.

SubstringEquals ( StringBuilder sb, int start, UString what, bool ignoreCase = false ) : bool

Checks if the sequences of characters what is equal to sb.Substring(start, what.Length), without actually creating a substring object.

Trim ( this sb ) : StringBuilder

Removes all leading and trailing occurrences of spaces and tabs from the StringBuilder object.

TrimEnd ( this sb ) : StringBuilder

Removes all trailing occurrences of spaces and tabs from the StringBuilder object.

TrimStart ( this sb ) : StringBuilder

Removes all leading occurrences of spaces and tabs from the StringBuilder object.

TryGet ( this s, int index, char defaultValue ) : char
TryGet ( this s, int index ) : char?

Private Methods

Method Description
SubstringEqualHelper ( StringBuilder sb, int start, UString what, bool ignoreCase = false ) : bool

Method Details

AppendCodePoint() public static method

Appends a unicode code point in the range 0 to 0x10FFFF to StringBuilder in UTF-16.
Invalid character c null StringBuildre
public static AppendCodePoint ( this s, int c ) : StringBuilder
s this
c int
return StringBuilder

EndsWith() public static method

Finds out whether the StringBuilder ends with the specified substring.
public static EndsWith ( this sb, UString what, bool ignoreCase = false ) : bool
sb this
what UString
ignoreCase bool
return bool

IndexOf() public static method

Gets the index of a substring in a StringBuilder
public static IndexOf ( this sb, UString searchStr, int startIndex, bool ignoreCase = false ) : int
sb this
searchStr UString
startIndex int
ignoreCase bool
return int

IndexOf() public static method

Gets the index of a character in a StringBuilder
public static IndexOf ( this sb, char value, int startIndex ) : int
sb this
value char
startIndex int
return int

Last() public static method

Returns the last character of the string
public static Last ( this str ) : char
str this
return char

LastIndexOf() public static method

Gets the index of a substring in a StringBuilder
public static LastIndexOf ( this sb, UString searchStr, int startIndex = int.MaxValue, bool ignoreCase = false ) : int
sb this
searchStr UString
startIndex int
ignoreCase bool
return int

LastIndexOf() public static method

Gets the index of a character in a StringBuilder
public static LastIndexOf ( this sb, char searchChar, int startIndex = int.MaxValue ) : int
sb this
searchChar char
startIndex int
return int

LastOrDefault() public static method

Returns the last character of the string, or a default character if the string is empty.
public static LastOrDefault ( this str, char @default = '\0' ) : char
str this
@default char
return char

StartsWith() public static method

Finds out whether the StringBuilder starts with the specified substring.
public static StartsWith ( this sb, UString what, bool ignoreCase = false ) : bool
sb this
what UString
ignoreCase bool
return bool

Substring() public static method

Extracts a substring from the specified StringBuiler.
public static Substring ( this sb, int startIndex, int length ) : string
sb this
startIndex int
length int
return string

SubstringEquals() public static method

Checks if the sequences of characters what is equal to sb.Substring(start, what.Length), without actually creating a substring object.
public static SubstringEquals ( StringBuilder sb, int start, UString what, bool ignoreCase = false ) : bool
sb StringBuilder
start int
what UString
ignoreCase bool
return bool

Trim() public static method

Removes all leading and trailing occurrences of spaces and tabs from the StringBuilder object.
public static Trim ( this sb ) : StringBuilder
sb this
return StringBuilder

TrimEnd() public static method

Removes all trailing occurrences of spaces and tabs from the StringBuilder object.
public static TrimEnd ( this sb ) : StringBuilder
sb this
return StringBuilder

TrimStart() public static method

Removes all leading occurrences of spaces and tabs from the StringBuilder object.
public static TrimStart ( this sb ) : StringBuilder
sb this
return StringBuilder

TryGet() public static method

public static TryGet ( this s, int index, char defaultValue ) : char
s this
index int
defaultValue char
return char

TryGet() public static method

public static TryGet ( this s, int index ) : char?
s this
index int
return char?