Link Search Menu Expand Document

Text.IsNullOrEmpty()

IsNullOrEmpty(value) => returns true if the value is a text and empty or null, false otherwise.

Returns true or false

Name Type Description
value any The variable or value to test

IsNullOrEmpty Uses the following rules:

  1. IsNullOrEmpty(‘data’) => false
  2. IsNullOrEmpty(‘’) => true
  3. IsNullOrEmpty(null) => true
  4. IsNullOrEmpty(5) => false

Note: All other data types will return false, this is mostly for text or consistent null checking.

Text.Trim()

Trim(value) => Removes whitespace from the beginning and ending of a text

Returns the same text but with leading and trailing whitespace removed.

Name Type Description
value Text The text to remove whitespace from
Trim('hello ') => 'hello'
Trim('    hello world ') => 'hello world'

Trim uses the C# trim() method internally. Details can be found on MSDN.

Text.Replace()

Replace(base, search, new, all?) => Replaces all instances of search in base with new and returns a new Text

Replaces all instances of search in base with new and returns a new Text.

Name Type Description
base Text The text to search within
search Text The text to search for
new Text The text to replace with
all? Boolean Indicates if all occurrences of search should be replaced, default is true

Used to replace characters within Text. For example:

Replace('hello world', 'world', 'atelerix');

would yield: the text 'hello atelerix'

Text.Substring()

Substring(value, beginIndex, length) => Returns a new Text that begins at beginIndex and is length characters long
Name Type Description
value Text The text to extract a substring from
beginIndex Number(Integer) Position of first character of the substring
length Number(Integer) Number of characters in the substring
Substring('hello world', 6, 5);

would yield: the text 'world'

Text.Left()

Left(value, count?) =>  Returns the left most character. If count is specified, the left most characters up to count so that the length of the resulting Text is count.
Name Type Description
value Text The text to return characters from
count? Number(Integer) The number of characters to return
Left('abcdef');

would yield: the text 'a'

Left('abcdef', 3);

would yield: the text 'abc'

Text.Right()

Right(value, count?) => Rturns the right most character. If count is specified, the right most characters up to count so that the length of the resulting Text is count.
Name Type Description
value Text The text to return characters from
count? Number(Integer) The number of characters to return
Right('abcdef');

would yield: the text 'f'

Right('abcdef', 3);

would yield: the text 'def'

Text.Length()

Length(value) => Returns the number of characters of the Text (including spaces, special characters etc.)
Name Type Description
value Text The text to calculate the length of
Length('hello world');

would yield: the number 11

Text.TestRegex()

TestRegex(value, expression) => Returns a Boolean (true or false) if the value satisfies the regular expression in expression. The regular expression should be provided as a string.
Name Type Description
value Text The text to run the regex expression on
expression Text The regex expression
TestRegex('The the quick brown fox  fox jumps over the lazy dog dog.', '\\b(?<word>\\w+)\\s+(\\k<word>)\\b');

would yield: the boolean true

Text.ExtractRegex()

ExtractRegex(value, expression) => Returns a List of Text objects, where each one satisfied the expression.
Name Type Description
value Text The text to run the regex expression on
expression Text The regex expression
ExtractRegex('The the quick brown fox  fox jumps over the lazy dog dog.', '\\b(?<word>\\w+)\\s+(\\k<word>)\\b');

would yield: the list "fox fox" , "dog dog"

Text.IsNull()

IsNull(value) => Tests that the value is null (not blank or missing or 0 length)
Name Type Description
value Text The text to check if null
IsNull(''); => false
IsNull(null); => true

Text.IsNotNull()

IsNotNull(value) => Tests that the value is not null
Name Type Description
value Text The text to check if not null
IsNotNull(''); => true
IsNotNull(null); => false

Text.ToTitleCase()

ToTitleCase(value) => Returns new Text that contains the value converted to title case
Name Type Description
value Text The text to be converted to title case

NOTE: Upper case words within the text will not be converted to title case. If you want to ensure the entire string is converted, first convert to lower case using Text.ToLower().

ToTitleCase('tHis iS my strinG'); => 'This Is My String'
ToTitleCase('hello world'); => 'Hello World'
ToTitleCase('HELLO world'); => 'HELLO World'

Text.ToLower()

ToLower(value) => Returns a new Text with value converted to lower case
Name Type Description
value Text The text to be converted to lower case
ToLower('HELLO World); => 'hello world'

Text.ToUpper()

ToUpper(value) => Returns a new Text with value converted to upper case
Name Type Description
value Text The text to be converted to upper case
ToUpper('hello world'); => 'HELLO WORLD'

Text.Split()

Split(value, separator) => Returns a List of Text from value split on the separator
Name Type Description
value Text The text to be split into a list
separator Text The text used to split value
Split('abc,def,ghi', ',');

would yield: the list "abc", "def", "ghi"

Text.UrlEncode()

UrlEncode(value) => Returns a new Text with the URL in value encoded using UTF-8 encoding
Name Type Description
value Text The URL to be encoded
UrlEncode('https://dymaptic.com/');

would yield: the text 'https%3a%2f%2fdymaptic.com%2f'