Enhanced C#
Language of your choice: library documentation
Static Public Member Functions | List of all members
Loyc.StringBuilderExt Class Reference

Extension methods that add some functionality of string to StringBuilder. More...


Source file:

Remarks

Extension methods that add some functionality of string to StringBuilder.

Static Public Member Functions

static string Substring (this StringBuilder sb, int startIndex, int length)
 Extracts a substring from the specified StringBuiler. More...
 
static char Last (this StringBuilder str)
 Returns the last character of the string More...
 
static char LastOrDefault (this StringBuilder str, char @default= '\0')
 Returns the last character of the string, or a default character if the string is empty. More...
 
static StringBuilder TrimStart (this StringBuilder sb)
 Removes all leading occurrences of spaces and tabs from the StringBuilder object. More...
 
static StringBuilder TrimStart (this StringBuilder sb, params char[] trimChars)
 Removes all leading occurrences of the specified set of characters from the StringBuilder object. More...
 
static StringBuilder TrimEnd (this StringBuilder sb)
 Removes all trailing occurrences of spaces and tabs from the StringBuilder object. More...
 
static StringBuilder TrimEnd (this StringBuilder sb, params char[] trimChars)
 Removes all trailing occurrences of the specified set of characters from the StringBuilder object. More...
 
static StringBuilder Trim (this StringBuilder sb)
 Removes all leading and trailing occurrences of spaces and tabs from the StringBuilder object. More...
 
static StringBuilder Trim (this StringBuilder sb, params char[] trimChars)
 Removes all leading and trailing occurrences of the specified set of characters from the StringBuilder object. More...
 
static int IndexOf (this StringBuilder sb, char value, int startIndex=0)
 Gets the index of a character in a StringBuilder More...
 
static int IndexOf (this StringBuilder sb, UString searchStr, int startIndex=0, bool ignoreCase=false)
 Gets the index of a substring in a StringBuilder More...
 
static int LastIndexOf (this StringBuilder sb, char searchChar, int startIndex=int.MaxValue)
 Gets the index of a character in a StringBuilder More...
 
static int LastIndexOf (this StringBuilder sb, UString searchStr, int startIndex=int.MaxValue, bool ignoreCase=false)
 Gets the index of a substring in a StringBuilder More...
 
static bool EndsWith (this StringBuilder sb, UString what, bool ignoreCase=false)
 Finds out whether the StringBuilder ends with the specified substring. More...
 
static bool StartsWith (this StringBuilder sb, UString what, bool ignoreCase=false)
 Finds out whether the StringBuilder starts with the specified substring. More...
 
static bool SubstringEquals (StringBuilder sb, int start, UString what, bool ignoreCase=false)
 Checks if the sequences of characters what is equal to sb.Substring(start, what.Length), without actually creating a substring object. More...
 
static char TryGet (this StringBuilder s, int index)
 
static char TryGet (this StringBuilder s, int index, char defaultValue)
 
static StringBuilder AppendCodePoint (this StringBuilder s, int c)
 Appends a unicode code point in the range 0 to 0x10FFFF to StringBuilder in UTF-16. More...
 

Member Function Documentation

static StringBuilder Loyc.StringBuilderExt.AppendCodePoint ( this StringBuilder  s,
int  c 
)
inlinestatic

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

Exceptions
ArgumentOutOfRangeExceptionInvalid character c
NullReferenceExceptionnull StringBuildre
static bool Loyc.StringBuilderExt.EndsWith ( this StringBuilder  sb,
UString  what,
bool  ignoreCase = false 
)
inlinestatic

Finds out whether the StringBuilder ends with the specified substring.

static int Loyc.StringBuilderExt.IndexOf ( this StringBuilder  sb,
char  value,
int  startIndex = 0 
)
inlinestatic

Gets the index of a character in a StringBuilder

Returns
Index of the first instance of the specified character in the string, or -1 if not found
static int Loyc.StringBuilderExt.IndexOf ( this StringBuilder  sb,
UString  searchStr,
int  startIndex = 0,
bool  ignoreCase = false 
)
inlinestatic

Gets the index of a substring in a StringBuilder

Returns
Index of the first instance of the specified substring in the StringBuilder, or -1 if not found
static char Loyc.StringBuilderExt.Last ( this StringBuilder  str)
inlinestatic

Returns the last character of the string

static int Loyc.StringBuilderExt.LastIndexOf ( this StringBuilder  sb,
char  searchChar,
int  startIndex = int.MaxValue 
)
inlinestatic

Gets the index of a character in a StringBuilder

Returns
Index of the last instance of the specified character in the StringBuilder, or -1 if not found
static int Loyc.StringBuilderExt.LastIndexOf ( this StringBuilder  sb,
UString  searchStr,
int  startIndex = int.MaxValue,
bool  ignoreCase = false 
)
inlinestatic

Gets the index of a substring in a StringBuilder

Returns
Index of the last instance of the specified substring in the StringBuilder, or -1 if not found
static char Loyc.StringBuilderExt.LastOrDefault ( this StringBuilder  str,
char @  default = '\0' 
)
inlinestatic

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

static bool Loyc.StringBuilderExt.StartsWith ( this StringBuilder  sb,
UString  what,
bool  ignoreCase = false 
)
inlinestatic

Finds out whether the StringBuilder starts with the specified substring.

static string Loyc.StringBuilderExt.Substring ( this StringBuilder  sb,
int  startIndex,
int  length 
)
inlinestatic

Extracts a substring from the specified StringBuiler.

static bool Loyc.StringBuilderExt.SubstringEquals ( StringBuilder  sb,
int  start,
UString  what,
bool  ignoreCase = false 
)
inlinestatic

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

static StringBuilder Loyc.StringBuilderExt.Trim ( this StringBuilder  sb)
inlinestatic

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

References Loyc.StringBuilderExt.Trim().

Referenced by Loyc.StringBuilderExt.Trim().

static StringBuilder Loyc.StringBuilderExt.Trim ( this StringBuilder  sb,
params char[]  trimChars 
)
inlinestatic

Removes all leading and trailing occurrences of the specified set of characters from the StringBuilder object.

Parameters
trimCharsAn array of Unicode characters to remove.

References Loyc.StringBuilderExt.TrimEnd(), and Loyc.StringBuilderExt.TrimStart().

static StringBuilder Loyc.StringBuilderExt.TrimEnd ( this StringBuilder  sb)
inlinestatic

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

References Loyc.StringBuilderExt.TrimEnd().

Referenced by Loyc.StringBuilderExt.Trim(), and Loyc.StringBuilderExt.TrimEnd().

static StringBuilder Loyc.StringBuilderExt.TrimEnd ( this StringBuilder  sb,
params char[]  trimChars 
)
inlinestatic

Removes all trailing occurrences of the specified set of characters from the StringBuilder object.

Parameters
trimCharsAn array of Unicode characters to remove.
static StringBuilder Loyc.StringBuilderExt.TrimStart ( this StringBuilder  sb)
inlinestatic

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

References Loyc.StringBuilderExt.TrimStart().

Referenced by Loyc.StringBuilderExt.Trim(), and Loyc.StringBuilderExt.TrimStart().

static StringBuilder Loyc.StringBuilderExt.TrimStart ( this StringBuilder  sb,
params char[]  trimChars 
)
inlinestatic

Removes all leading occurrences of the specified set of characters from the StringBuilder object.

Parameters
trimCharsAn array of Unicode characters to remove.