StringHelper Class
Provides numerous utility methods for working with strings.
public static class StringHelper
- Inheritance:
- System.Object Object
Methods
ContainsRtlCharacters(String)
Returns whether the specified text string contains any right-to-left characters.
public static bool ContainsRtlCharacters(string text)
| Parameter | Type | Description |
|---|---|---|
| text | System.String | The string to examine. |
Returns
- System.Boolean:
trueif the string contains any right-to-left characters; otherwise,false.
ConvertTextToLines(String)
Converts the text to an array of lines.
public static IList<string> ConvertTextToLines(string text)
| Parameter | Type | Description |
|---|---|---|
| text | System.String | The text to examine. |
Returns
- System.Collections.Generic.IList<System.String>:
The array of lines.
CreateDescription(String)
Returns a description from a key.
public static string CreateDescription(string key)
| Parameter | Type | Description |
|---|---|---|
| key | System.String | The key to examine. |
Returns
- System.String:
The description that was created.
GetIndentAmount(String, Int32)
Returns the indent amount of the specified text.
public static int GetIndentAmount(string text, int tabSize)
| Parameter | Type | Description |
|---|---|---|
| text | System.String | The text to examine. |
| tabSize | System.Int32 | The tab size. |
Returns
- System.Int32:
The indent amount of the specified text.
GetIndentText(Boolean, Int32, Int32)
Returns the string to use for indenting by the specified amount.
public static string GetIndentText(bool convertTabsToSpaces, int tabSize, int indentAmount)
| Parameter | Type | Description |
|---|---|---|
| convertTabsToSpaces | System.Boolean | Whether to convert tabs to spaces. |
| tabSize | System.Int32 | The number of columns in a tab. |
| indentAmount | System.Int32 | The number of columns to indent. |
Returns
- System.String:
The string to use for indenting by the specified amount.
GetLineTerminatorText(LineTerminator)
Returns the text representation of the specified LineTerminator.
public static string GetLineTerminatorText(LineTerminator lineTerminator)
| Parameter | Type | Description |
|---|---|---|
| lineTerminator | LineTerminator | The LineTerminator to examine. |
Returns
- System.String:
The text representation of the specified LineTerminator.
GetTextPositionDelta(String)
Returns the TextPosition delta of the specified inserted text.
public static TextPosition GetTextPositionDelta(string text)
| Parameter | Type | Description |
|---|---|---|
| text | System.String | The text to examine. |
Returns
- TextPosition:
The TextPosition delta of the specified inserted text.
IsRtlCharacter(Char)
Returns whether the specified character is a right-to-left character.
public static bool IsRtlCharacter(char ch)
| Parameter | Type | Description |
|---|---|---|
| ch | System.Char | The character to examine. |
Returns
- System.Boolean:
trueif the specified character is a right-to-left character; otherwise,false.
TrimTrailingWhitespace(ref String)
Trims the trailing whitespace off of the specified text.
public static bool TrimTrailingWhitespace(ref string text)
| Parameter | Type | Description |
|---|---|---|
| text | System.String | The text to modify. |
Returns
- System.Boolean:
trueif a change was made; otherwise,false.
Inherited Members
- System.Object.ToString()
- System.Object.Equals(System.Object)
- System.Object.Equals(System.Object, System.Object)
- System.Object.ReferenceEquals(System.Object, System.Object)
- System.Object.GetHashCode()
- System.Object.GetType()
- System.Object.MemberwiseClone()