C# Класс Rolcore.StringExtensions

Extensions for String.
Показать файл Открыть проект

Открытые методы

Метод Описание
EnsureTrailing ( this s, char c ) : string

Checks that the string ends with the specified character. If it doesn't then the character is appended.

First ( this s, int numberOfCharacters ) : string

Returns the first part of a string, up to a specified number of characters.

FromBase64String ( this s ) : string

Converts the string from a Base64 encoded string to a "regular" string.

FromBase64UriSafeString ( this s ) : string

Converts the string from a Base64 encoded string to a "regular" string.

IsPalindrome ( this s ) : bool

Determines if the given string is a palindrome (can be read the same forwards and backwards).

Repeat ( this s, int numberOfTimes ) : string

Repeats a string some number of times.

Reverse ( this s ) : string

Reverses the given string.

ToBase64String ( this s ) : string

Converts the string to a Base64 encoded string.

ToBase64UriSafeString ( this s ) : string

Converts the string to a URI-safe Base64 encoded string. Read about URL and file safe base64 encoding at http://tools.ietf.org/html/rfc4648#page-7.

ToSHA1String ( this s ) : string

Computes a SHA-1 hash of the specified string.

ToUri ( this s, Uri baseUri = null ) : Uri

Converts the string to a Uri.

Описание методов

EnsureTrailing() публичный статический Метод

Checks that the string ends with the specified character. If it doesn't then the character is appended.
public static EnsureTrailing ( this s, char c ) : string
s this Specifies the string to check.
c char Specifies the character to check for.
Результат string

First() публичный статический Метод

Returns the first part of a string, up to a specified number of characters.
public static First ( this s, int numberOfCharacters ) : string
s this The string from which to get the sub string.
numberOfCharacters int The number of characters to get from the string
Результат string

FromBase64String() публичный статический Метод

Converts the string from a Base64 encoded string to a "regular" string.
public static FromBase64String ( this s ) : string
s this The string to decode.
Результат string

FromBase64UriSafeString() публичный статический Метод

Converts the string from a Base64 encoded string to a "regular" string.
public static FromBase64UriSafeString ( this s ) : string
s this The string to decode.
Результат string

IsPalindrome() публичный статический Метод

Determines if the given string is a palindrome (can be read the same forwards and backwards).
public static IsPalindrome ( this s ) : bool
s this Specifies the string to check.
Результат bool

Repeat() публичный статический Метод

Repeats a string some number of times.
public static Repeat ( this s, int numberOfTimes ) : string
s this The string to be repeated.
numberOfTimes int The number of times to repeat the string. A value of zero /// returns an empty string, a value of one returns the original string, a value of two or /// more returns the string repeated that number of times.
Результат string

Reverse() публичный статический Метод

Reverses the given string.
public static Reverse ( this s ) : string
s this Specfies the string to reverse.
Результат string

ToBase64String() публичный статический Метод

Converts the string to a Base64 encoded string.
public static ToBase64String ( this s ) : string
s this The string to encode
Результат string

ToBase64UriSafeString() публичный статический Метод

Converts the string to a URI-safe Base64 encoded string. Read about URL and file safe base64 encoding at http://tools.ietf.org/html/rfc4648#page-7.
public static ToBase64UriSafeString ( this s ) : string
s this The string to encode
Результат string

ToSHA1String() публичный статический Метод

Computes a SHA-1 hash of the specified string.
public static ToSHA1String ( this s ) : string
s this The string to hash.
Результат string

ToUri() публичный статический Метод

Converts the string to a Uri.
public static ToUri ( this s, Uri baseUri = null ) : Uri
s this Specifies the string to convert.
baseUri System.Uri Optionally specifies the base URI if the specified string is (or might be) relative.
Результат System.Uri