Class StringExtensions
Represents various extension methods for type string.
Inherited Members
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class StringExtensions
Methods
| Edit this page View SourceReverse(string?)
Reverse string characters.
Declaration
public static string? Reverse(this string? str)
Parameters
Type | Name | Description |
---|---|---|
string | str | The string to reverse. |
Returns
Type | Description |
---|---|
string | The string in inverse order of characters. |
Substring(string, Range)
Extracts substring from the given string.
Declaration
public static string Substring(this string str, Range range)
Parameters
Type | Name | Description |
---|---|---|
string | str | The instance of string. |
Range | range | The range of substring. |
Returns
Type | Description |
---|---|
string | The part of |
Remarks
This method if useful for .NET languages without syntactic support of ranges.
TrimLength(string?, int)
Trims the source string to specified length if it exceeds it.
If source string is less that maxLength
then the source string returned.
Declaration
public static string? TrimLength(this string? str, int maxLength)
Parameters
Type | Name | Description |
---|---|---|
string | str | Source string. |
int | maxLength | Maximum length. |
Returns
Type | Description |
---|---|
string | Trimmed string value. |
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException |
|