C# Class Tp.Core.StringUtils

Basic string manipulation routines.
Afficher le fichier Open project: TargetProcess/Target-Process-Plugins

Méthodes publiques

Свойство Type Description
EmailRegex System.Text.RegularExpressions.Regex
LineBreaks string[]

Méthodes publiques

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

Private Methods

Méthode Description
TrimToEmpty ( this value ) : string
TrimToNull ( this value ) : string

Method Details

Base64ToImage() public static méthode

public static Base64ToImage ( this base64String ) : Image
base64String this
Résultat Image

ComputeMD5Hash() public static méthode

public static ComputeMD5Hash ( this value ) : string
value this
Résultat string

ComputeMD5Hash() public static méthode

public static ComputeMD5Hash ( this value, Encoding encoding ) : string
value this
encoding System.Text.Encoding
Résultat string

DecodeFromBase64() public static méthode

public static DecodeFromBase64 ( this value ) : string
value this
Résultat string

EncodeToBase64() public static méthode

public static EncodeToBase64 ( this value ) : string
value this
Résultat string

EqualWithoutSpaces() public static méthode

public static EqualWithoutSpaces ( this a, string b, System.StringComparison comparison = StringComparison.CurrentCulture ) : bool
a this
b string
comparison System.StringComparison
Résultat bool

GetAbbreviation() public static méthode

public static GetAbbreviation ( string text ) : string
text string
Résultat string

GetGroupMatch() public static méthode

public static GetGroupMatch ( this value, string pattern ) : string
value this
pattern string
Résultat string

GetGroupMatch() public static méthode

public static GetGroupMatch ( this value, string pattern, int groupId ) : string
value this
pattern string
groupId int
Résultat string

GetLastWord() public static méthode

public static GetLastWord ( string name ) : string
name string
Résultat string

GetWords() public static méthode

public static GetWords ( string text, char delimiter = ' ' ) : string[]
text string
delimiter char
Résultat string[]

IsBlank() public static méthode

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

IsEmail() public static méthode

Verify whether string is a valid email address.
public static IsEmail ( this value ) : bool
value this A string.
Résultat bool

IsManyWords() public static méthode

public static IsManyWords ( string text, char delimiter = ' ' ) : bool
text string
delimiter char
Résultat bool

IsNotBlank() public static méthode

Inverse of IsBlank.
public static IsNotBlank ( this value ) : bool
value this The string to test.
Résultat bool

Simplify() public static méthode

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

ToIntList() public static méthode

public static ToIntList ( this ids ) : List
ids this
Résultat List

ToStringArray() public static méthode

public static ToStringArray ( this tags ) : string
tags this
Résultat string

ToStringList() public static méthode

public static ToStringList ( this ids ) : List
ids this
Résultat List

Truncate() public static méthode

public static Truncate ( this originString, int maxLength ) : string
originString this
maxLength int
Résultat string

Property Details

EmailRegex public_oe static_oe property

A regular expression to validate email addresses.
public static Regex,System.Text.RegularExpressions EmailRegex
Résultat System.Text.RegularExpressions.Regex

LineBreaks public_oe static_oe property

public static string[] LineBreaks
Résultat string[]