C# Class Tp.Core.StringUtils

Basic string manipulation routines.
Mostra file Open project: TargetProcess/Target-Process-Plugins

Public Properties

Property Type Description
EmailRegex System.Text.RegularExpressions.Regex
LineBreaks string[]

Public Methods

Method 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

Method Description
TrimToEmpty ( this value ) : string
TrimToNull ( this value ) : string

Method Details

Base64ToImage() public static method

public static Base64ToImage ( this base64String ) : Image
base64String this
return Image

ComputeMD5Hash() public static method

public static ComputeMD5Hash ( this value ) : string
value this
return string

ComputeMD5Hash() public static method

public static ComputeMD5Hash ( this value, Encoding encoding ) : string
value this
encoding System.Text.Encoding
return string

DecodeFromBase64() public static method

public static DecodeFromBase64 ( this value ) : string
value this
return string

EncodeToBase64() public static method

public static EncodeToBase64 ( this value ) : string
value this
return string

EqualWithoutSpaces() public static method

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

GetAbbreviation() public static method

public static GetAbbreviation ( string text ) : string
text string
return string

GetGroupMatch() public static method

public static GetGroupMatch ( this value, string pattern ) : string
value this
pattern string
return string

GetGroupMatch() public static method

public static GetGroupMatch ( this value, string pattern, int groupId ) : string
value this
pattern string
groupId int
return string

GetLastWord() public static method

public static GetLastWord ( string name ) : string
name string
return string

GetWords() public static method

public static GetWords ( string text, char delimiter = ' ' ) : string[]
text string
delimiter char
return string[]

IsBlank() public static method

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.
return bool

IsEmail() public static method

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

IsManyWords() public static method

public static IsManyWords ( string text, char delimiter = ' ' ) : bool
text string
delimiter char
return bool

IsNotBlank() public static method

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

Simplify() public static method

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.
return string

ToIntList() public static method

public static ToIntList ( this ids ) : List
ids this
return List

ToStringArray() public static method

public static ToStringArray ( this tags ) : string
tags this
return string

ToStringList() public static method

public static ToStringList ( this ids ) : List
ids this
return List

Truncate() public static method

public static Truncate ( this originString, int maxLength ) : string
originString this
maxLength int
return string

Property Details

EmailRegex public_oe static_oe property

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

LineBreaks public_oe static_oe property

public static string[] LineBreaks
return string[]