StringHelper Class
Provides numerous utility methods for working with strings.
public static class StringHelper
- Inheritance:
- 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 | string | The string to examine. |
Returns
- bool:
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 | string | The text to examine. |
Returns
CreateDescription(string)
Returns a description from a key.
public static string CreateDescription(string key)
| Parameter | Type | Description |
|---|---|---|
| key | string | The key to examine. |
Returns
- string:
The description that was created.
GetIndentAmount(string, int)
Returns the indent amount of the specified text.
public static int GetIndentAmount(string text, int tabSize)
| Parameter | Type | Description |
|---|---|---|
| text | string | The text to examine. |
| tabSize | int | The tab size. |
Returns
- int:
The indent amount of the specified text.
GetIndentText(bool, int, int)
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 | bool | Whether to convert tabs to spaces. |
| tabSize | int | The number of columns in a tab. |
| indentAmount | int | The number of columns to indent. |
Returns
- 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
- 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 | 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 | char | The character to examine. |
Returns
- bool:
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 | string | The text to modify. |
Returns
- bool:
trueif a change was made; otherwise,false.