Show / Hide Table of Contents

Class StringExtensions

Represents various extension methods for type string.

Inheritance
object
StringExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext
Assembly: DotNext.dll
Syntax
public static class StringExtensions

Methods

| Edit this page View Source

Reverse(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.

| Edit this page View Source

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 str extracted according to the supplied range.

Remarks

This method if useful for .NET languages without syntactic support of ranges.

| Edit this page View Source

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

maxLength is less than zero.

  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾