C# Класс Tp.Core.StringUtils

Basic string manipulation routines.
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
EmailRegex System.Text.RegularExpressions.Regex
LineBreaks string[]

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

Метод Описание
Base64ToImage ( this base64String ) : Image
ComputeMD5Hash ( this value ) : string
ComputeMD5Hash ( this value, Encoding encoding ) : string
DecodeFromBase64 ( this value ) : string
EncodeToBase64 ( this value ) : string
EqualWithoutSpaces ( this a, string b, System.StringComparison comparison = StringComparison.CurrentCulture ) : bool
GetAbbreviation ( string text ) : string
GetGroupMatch ( this value, string pattern ) : string
GetGroupMatch ( this value, string pattern, int groupId ) : string
GetLastWord ( string name ) : string
GetWords ( string text, char delimiter = ' ' ) : string[]
IsBlank ( this value ) : bool

Verifies whether the specified string is null or white space only. This method is null-safe.

Here is how it works: Assert.IsTrue(StringUtils.IsBlank(null)); Assert.IsTrue(StringUtils.IsBlank("")); Assert.IsTrue(StringUtils.IsBlank(" ")); Assert.IsFalse(StringUtils.IsBlank(" hello "));

IsEmail ( this value ) : bool

Verify whether string is a valid email address.

IsManyWords ( string text, char delimiter = ' ' ) : bool
IsNotBlank ( this value ) : bool

Inverse of IsBlank.

Simplify ( this value ) : string

Remove any whitespace, punctuation and graphics from the specified string, convert result to lower case.

Here is how it works: Assert.IsNull(StringUtils.Simplify(null)); Assert.IsNull(StringUtils.Simplify("")); Assert.IsNull(StringUtils.Simplify(" ")); Assert.AreEqual("helloworld", StringUtils.Simplify(" Hello, World! ")); Assert.AreEqual("iam99yearsold", StringUtils.Simplify(" I am 99 years old! "));

ToIntList ( this ids ) : List
ToStringArray ( this tags ) : string
ToStringList ( this ids ) : List
Truncate ( this originString, int maxLength ) : string

Приватные методы

Метод Описание
TrimToEmpty ( this value ) : string
TrimToNull ( this value ) : string

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

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

public static Base64ToImage ( this base64String ) : Image
base64String this
Результат Image

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

public static ComputeMD5Hash ( this value ) : string
value this
Результат string

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

public static ComputeMD5Hash ( this value, Encoding encoding ) : string
value this
encoding System.Text.Encoding
Результат string

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

public static DecodeFromBase64 ( this value ) : string
value this
Результат string

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

public static EncodeToBase64 ( this value ) : string
value this
Результат string

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

public static EqualWithoutSpaces ( this a, string b, System.StringComparison comparison = StringComparison.CurrentCulture ) : bool
a this
b string
comparison System.StringComparison
Результат bool

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

public static GetAbbreviation ( string text ) : string
text string
Результат string

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

public static GetGroupMatch ( this value, string pattern ) : string
value this
pattern string
Результат string

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

public static GetGroupMatch ( this value, string pattern, int groupId ) : string
value this
pattern string
groupId int
Результат string

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

public static GetLastWord ( string name ) : string
name string
Результат string

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

public static GetWords ( string text, char delimiter = ' ' ) : string[]
text string
delimiter char
Результат string[]

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

Verifies whether the specified string is null or white space only. This method is null-safe.
Here is how it works: Assert.IsTrue(StringUtils.IsBlank(null)); Assert.IsTrue(StringUtils.IsBlank("")); Assert.IsTrue(StringUtils.IsBlank(" ")); Assert.IsFalse(StringUtils.IsBlank(" hello "));
public static IsBlank ( this value ) : bool
value this The string to test.
Результат bool

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

Verify whether string is a valid email address.
public static IsEmail ( this value ) : bool
value this A string.
Результат bool

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

public static IsManyWords ( string text, char delimiter = ' ' ) : bool
text string
delimiter char
Результат bool

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

Inverse of IsBlank.
public static IsNotBlank ( this value ) : bool
value this The string to test.
Результат bool

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

Remove any whitespace, punctuation and graphics from the specified string, convert result to lower case.
Here is how it works: Assert.IsNull(StringUtils.Simplify(null)); Assert.IsNull(StringUtils.Simplify("")); Assert.IsNull(StringUtils.Simplify(" ")); Assert.AreEqual("helloworld", StringUtils.Simplify(" Hello, World! ")); Assert.AreEqual("iam99yearsold", StringUtils.Simplify(" I am 99 years old! "));
public static Simplify ( this value ) : string
value this Original value.
Результат string

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

public static ToIntList ( this ids ) : List
ids this
Результат List

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

public static ToStringArray ( this tags ) : string
tags this
Результат string

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

public static ToStringList ( this ids ) : List
ids this
Результат List

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

public static Truncate ( this originString, int maxLength ) : string
originString this
maxLength int
Результат string

Описание свойств

EmailRegex публичное статическое свойство

A regular expression to validate email addresses.
public static Regex,System.Text.RegularExpressions EmailRegex
Результат System.Text.RegularExpressions.Regex

LineBreaks публичное статическое свойство

public static string[] LineBreaks
Результат string[]