Energy Core Library
Energy.Base.Text Class Reference

Text related functions More...

Public Member Functions

delegate string ConvertAction (string value)
 Test function delegate More...
 

Static Public Member Functions

static void Exchange (ref string first, ref string second)
 Exchange texts between each other More...
 
static string Select (params string[] list)
 Select first non empty string element More...
 
static string Surround (string value, string delimiter, string[] special)
 Surround text with delimiters if contains delimiter itself or any of special characters. More...
 
static string Surround (string value, string delimiter)
 Surround text with delimiters if contains delimiter itself or any of special characters More...
 
static string Surround (string text, string prefix, string suffix, bool optional)
 Surround text with prefix and suffix, optionally adding prefix only when needed. More...
 
static string Texture (string pattern, int size)
 Repeat string pattern to specified amount of characters length. More...
 
static string Trim (string value)
 Remove leading and trailing whitespace. Includes space, tabulation (horizontal and vertical), new line and null characters. More...
 
static bool IsWild (string text)
 Check if string contains one of wild characters ("*" or "?") More...
 
static bool IsLike (string text)
 Check if string contains one of characters used in LIKE ("%" or "_") More...
 
static bool Check (string input, MatchStyle matchStyle, MatchMode matchMode, bool ignoreCase, string[] filters)
 
static bool CheckAny (string input, MatchMode matchMode, bool ignoreCase, params string[] filters)
 
static bool CheckAll (string input, MatchMode matchMode, bool ignoreCase, params string[] filters)
 
static bool CheckNot (string input, MatchMode matchMode, bool ignoreCase, params string[] filters)
 
static bool CheckOne (string input, MatchMode matchMode, bool ignoreCase, params string[] filters)
 
static bool Check (string input, MatchMode matchMode, bool ignoreCase, string filter)
 
static bool CheckRegex (string input, string pattern, RegexOptions options)
 
static bool CheckRegex (string input, string pattern, bool ignoreCase)
 
static bool CheckWild (string input, string wild, bool ignoreCase)
 
static bool CheckSame (string input, string filter, bool ignoreCase)
 
static bool CheckSimple (string input, string filter, bool ignoreCase)
 Check if input string is equal or starts or ends with filter string. More...
 
static string Join (string with, params string[] array)
 Join non empty strings into one list with separator More...
 
static string JoinWith (string with, params string[] array)
 Join non empty strings into one list with separator More...
 
static IEnumerable< string > Each (string input)
 
static string [] SplitNewLine (string content)
 Split string to array by new line characters. Elements will not include new line itself. More...
 
static string [] SplitNewLine (string content, bool removeEmptyEntries)
 Split string to array by new line characters. Elements will not include new line itself. More...
 
static string [] Split (string input)
 
static string [] SplitList (string text, string commas, string quotes)
 Split string to array by separators with optional quoted elements. May be used to explode from strings like "1,2,3", "abc def xyz", "'Smith''s Home'|'Special | New'|Other value". More...
 
static string [] SplitDictionary (string text, string quotes, string equalities, string brackets)
 Split string by new line More...
 
static string Convert (string value, ConvertAction action)
 
static string [] Convert (string[] array, ConvertAction action)
 
static bool Contains (object o, string search)
 Check if object as string contains searched string. More...
 
static char GetMiddleStringPatternChar (string pattern)
 Get middle character from a pattern string. If the length of pattern text is even or empty, function will return an empty character. More...
 
static string GetMiddleStringPrefix (string pattern)
 Get left part from a pattern string. More...
 
static string GetMiddleStringSuffix (string pattern)
 Get right part from a pattern string. More...
 
static string RemoveWhitespace (string value)
 Remove whitespace characters from entire string. More...
 
static bool ContainsWhitespace (char[] charArray)
 Check if array contains any of whitespace character. More...
 
static string Limit (string text, int limit)
 Limit string to have maximum count of characters. More...
 
static string Limit (string text, int limit, string suffix)
 Limit string to have maximum count characters with optional suffix if it was cut off. More...
 
static string Limit (string text, int limit, string prefix, string suffix)
 Limit string to have maximum count characters with optional prefix or suffix if it was cut off. More...
 
static string WildToLike (string text)
 Convert text containing wild characters (?, *) to SQL like format (_, %). More...
 
static string WildToRegex (string value)
 Convert string containing wild characters (*, ?) into Regex pattern. More...
 
static string LikeToRegex (string value)
 Convert LIKE string into Regex pattern. More...
 
static string RemoveEmptyLines (string text)
 Remove empty lines from string. More...
 

Properties

static string BR [get]
 HTML break More...
 
static string NL [get]
 New line "character" More...
 
static string WS [get]
 Whitespace characters string More...
 

Detailed Description

Text related functions

Member Function Documentation

◆ Check() [1/2]

static bool Energy.Base.Text.Check ( string  input,
MatchStyle  matchStyle,
MatchMode  matchMode,
bool  ignoreCase,
string []  filters 
)
static

◆ Check() [2/2]

static bool Energy.Base.Text.Check ( string  input,
MatchMode  matchMode,
bool  ignoreCase,
string  filter 
)
static

◆ CheckAll()

static bool Energy.Base.Text.CheckAll ( string  input,
MatchMode  matchMode,
bool  ignoreCase,
params string []  filters 
)
static

◆ CheckAny()

static bool Energy.Base.Text.CheckAny ( string  input,
MatchMode  matchMode,
bool  ignoreCase,
params string []  filters 
)
static

◆ CheckNot()

static bool Energy.Base.Text.CheckNot ( string  input,
MatchMode  matchMode,
bool  ignoreCase,
params string []  filters 
)
static

◆ CheckOne()

static bool Energy.Base.Text.CheckOne ( string  input,
MatchMode  matchMode,
bool  ignoreCase,
params string []  filters 
)
static

◆ CheckRegex() [1/2]

static bool Energy.Base.Text.CheckRegex ( string  input,
string  pattern,
RegexOptions  options 
)
static

◆ CheckRegex() [2/2]

static bool Energy.Base.Text.CheckRegex ( string  input,
string  pattern,
bool  ignoreCase 
)
static

◆ CheckSame()

static bool Energy.Base.Text.CheckSame ( string  input,
string  filter,
bool  ignoreCase 
)
static

◆ CheckSimple()

static bool Energy.Base.Text.CheckSimple ( string  input,
string  filter,
bool  ignoreCase 
)
static

Check if input string is equal or starts or ends with filter string.

Parameters
input
filter
ignoreCase
Returns

◆ CheckWild()

static bool Energy.Base.Text.CheckWild ( string  input,
string  wild,
bool  ignoreCase 
)
static

◆ Contains()

static bool Energy.Base.Text.Contains ( object  o,
string  search 
)
static

Check if object as string contains searched string.

Parameters
oObject
search
Returns

◆ ContainsWhitespace()

static bool Energy.Base.Text.ContainsWhitespace ( char []  charArray)
static

Check if array contains any of whitespace character.

Parameters
charArray
Returns

◆ Convert() [1/2]

static string Energy.Base.Text.Convert ( string  value,
ConvertAction  action 
)
static

◆ Convert() [2/2]

static string [] Energy.Base.Text.Convert ( string []  array,
ConvertAction  action 
)
static

◆ ConvertAction()

delegate string Energy.Base.Text.ConvertAction ( string  value)

Test function delegate

◆ Each()

static IEnumerable<string> Energy.Base.Text.Each ( string  input)
static

◆ Exchange()

static void Energy.Base.Text.Exchange ( ref string  first,
ref string  second 
)
static

Exchange texts between each other

Parameters
first
second

◆ GetMiddleStringPatternChar()

static char Energy.Base.Text.GetMiddleStringPatternChar ( string  pattern)
static

Get middle character from a pattern string. If the length of pattern text is even or empty, function will return an empty character.

Parameters
pattern
Returns

◆ GetMiddleStringPrefix()

static string Energy.Base.Text.GetMiddleStringPrefix ( string  pattern)
static

Get left part from a pattern string.

Parameters
pattern
Returns

◆ GetMiddleStringSuffix()

static string Energy.Base.Text.GetMiddleStringSuffix ( string  pattern)
static

Get right part from a pattern string.

Parameters
pattern
Returns

◆ IsLike()

static bool Energy.Base.Text.IsLike ( string  text)
static

Check if string contains one of characters used in LIKE ("%" or "_")

Parameters
textstring
Returns
bool

◆ IsWild()

static bool Energy.Base.Text.IsWild ( string  text)
static

Check if string contains one of wild characters ("*" or "?")

Parameters
textstring
Returns
bool

◆ Join()

static string Energy.Base.Text.Join ( string  with,
params string []  array 
)
static

Join non empty strings into one list with separator

Parameters
withSeparator string
arrayParts to join
Returns
Example: JoinWith(" : ", "A", "B", "", "C") = "A : B : C".

◆ JoinWith()

static string Energy.Base.Text.JoinWith ( string  with,
params string []  array 
)
static

Join non empty strings into one list with separator

Parameters
withSeparator string
arrayParts to join
Returns
Example: JoinWith(" : ", "A", "B", "", "C") = "A : B : C".

◆ LikeToRegex()

static string Energy.Base.Text.LikeToRegex ( string  value)
static

Convert LIKE string into Regex pattern.

Parameters
valuestring
Returns

◆ Limit() [1/3]

static string Energy.Base.Text.Limit ( string  text,
int  limit 
)
static

Limit string to have maximum count of characters.

Parameters
textstring
limitint
Returns
string

◆ Limit() [2/3]

static string Energy.Base.Text.Limit ( string  text,
int  limit,
string  suffix 
)
static

Limit string to have maximum count characters with optional suffix if it was cut off.

Parameters
textstring
limitint
suffixstring
Returns
string

◆ Limit() [3/3]

static string Energy.Base.Text.Limit ( string  text,
int  limit,
string  prefix,
string  suffix 
)
static

Limit string to have maximum count characters with optional prefix or suffix if it was cut off.

Parameters
textstring
limitint
prefixstring
suffixstring
Returns
string

◆ RemoveEmptyLines()

static string Energy.Base.Text.RemoveEmptyLines ( string  text)
static

Remove empty lines from string.

Parameters
text
Returns

◆ RemoveWhitespace()

static string Energy.Base.Text.RemoveWhitespace ( string  value)
static

Remove whitespace characters from entire string.

Parameters
value
Returns

◆ Select()

static string Energy.Base.Text.Select ( params string []  list)
static

Select first non empty string element

Parameters
liststring[]
Returns
string

◆ Split()

static string [] Energy.Base.Text.Split ( string  input)
static

◆ SplitDictionary()

static string [] Energy.Base.Text.SplitDictionary ( string  text,
string  quotes,
string  equalities,
string  brackets 
)
static

Split string by new line

Returns

◆ SplitList()

static string [] Energy.Base.Text.SplitList ( string  text,
string  commas,
string  quotes 
)
static

Split string to array by separators with optional quoted elements. May be used to explode from strings like "1,2,3", "abc def xyz", "'Smith''s Home'|'Special | New'|Other value".

Returns

◆ SplitNewLine() [1/2]

static string [] Energy.Base.Text.SplitNewLine ( string  content)
static

Split string to array by new line characters. Elements will not include new line itself.

Parameters
content
Returns

◆ SplitNewLine() [2/2]

static string [] Energy.Base.Text.SplitNewLine ( string  content,
bool  removeEmptyEntries 
)
static

Split string to array by new line characters. Elements will not include new line itself.

Parameters
content
removeEmptyEntries
Returns

◆ Surround() [1/3]

static string Energy.Base.Text.Surround ( string  value,
string  delimiter,
string []  special 
)
static

Surround text with delimiters if contains delimiter itself or any of special characters.

Parameters
valueText value
delimiterDelimiter like ' or "</param> <param name="special">List of special char
Returns

◆ Surround() [2/3]

static string Energy.Base.Text.Surround ( string  value,
string  delimiter 
)
static

Surround text with delimiters if contains delimiter itself or any of special characters

Parameters
valueText value
delimiterDelimiter like ' or "
Returns

◆ Surround() [3/3]

static string Energy.Base.Text.Surround ( string  text,
string  prefix,
string  suffix,
bool  optional 
)
static

Surround text with prefix and suffix, optionally adding prefix only when needed.

Parameters
textText to surround
prefixPrefix to add at begining
suffixSuffix to add at ending
optionalAdd prefix and suffix only when needed
Returns

◆ Texture()

static string Energy.Base.Text.Texture ( string  pattern,
int  size 
)
static

Repeat string pattern to specified amount of characters length.

Parameters
pattern
size
Returns

◆ Trim()

static string Energy.Base.Text.Trim ( string  value)
static

Remove leading and trailing whitespace. Includes space, tabulation (horizontal and vertical), new line and null characters.

Parameters
valueString value
Returns
Trimmed string

◆ WildToLike()

static string Energy.Base.Text.WildToLike ( string  text)
static

Convert text containing wild characters (?, *) to SQL like format (_, %).

Parameters
textstring
Returns
string

◆ WildToRegex()

static string Energy.Base.Text.WildToRegex ( string  value)
static

Convert string containing wild characters (*, ?) into Regex pattern.

Parameters
valuestring
Returns

Property Documentation

◆ BR

string Energy.Base.Text.BR
staticget

HTML break

◆ NL

string Energy.Base.Text.NL
staticget

New line "character"

◆ WS

string Energy.Base.Text.WS
staticget

Whitespace characters string


The documentation for this class was generated from the following file: