C# Class Rolcore.StringExtensions

Extensions for String.
Afficher le fichier Open project: Rollins/Rolcore

Méthodes publiques

Méthode Description
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.

Method Details

EnsureTrailing() public static méthode

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.
Résultat string

First() public static méthode

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
Résultat string

FromBase64String() public static méthode

Converts the string from a Base64 encoded string to a "regular" string.
public static FromBase64String ( this s ) : string
s this The string to decode.
Résultat string

FromBase64UriSafeString() public static méthode

Converts the string from a Base64 encoded string to a "regular" string.
public static FromBase64UriSafeString ( this s ) : string
s this The string to decode.
Résultat string

IsPalindrome() public static méthode

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.
Résultat bool

Repeat() public static méthode

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.
Résultat string

Reverse() public static méthode

Reverses the given string.
public static Reverse ( this s ) : string
s this Specfies the string to reverse.
Résultat string

ToBase64String() public static méthode

Converts the string to a Base64 encoded string.
public static ToBase64String ( this s ) : string
s this The string to encode
Résultat string

ToBase64UriSafeString() public static méthode

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
Résultat string

ToSHA1String() public static méthode

Computes a SHA-1 hash of the specified string.
public static ToSHA1String ( this s ) : string
s this The string to hash.
Résultat string

ToUri() public static méthode

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.
Résultat System.Uri