Cast value to a string or nil if not possible.
Name | Type | Description |
---|---|---|
value | any | value to cast |
var string = "27"; let string = num.cast(string); let num = (string - 12); num;
Compare two strings.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Compare the first string to the second string
var first = "MindTouch"; var second = "Touch"; if (string.compare(first,second)) { "The first string is different than the second"; } else { "The first string is Exactly the same as the second"; }
Check if the first string contains the second string.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
See if FIRST contains SECOND while ignoring the case
if (string.contains("MindTouch","mind",true)) { "Match!"; } else { "One does not contain the other"; }
Convert a string into a value.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if the first string ends with the second string.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Determine equality of two strings
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Escape special characters in string.
Name | Type | Description |
---|---|---|
value | str | string value |
Evaluate a dekiscript expression.
Name | Type | Description |
---|---|---|
code | str | dekiscript expression |
ignoreErrors | bool | (optional) ignore errors during evaluation |
Replaces placeholders with values in a string.
Name | Type | Description |
---|---|---|
text | str | string with placeholders |
values | any | (optional) values to insert into string |
The follow table shows argument combinations and their outcomes.
Text | Values | Result |
---|---|---|
nil | nil | |
"" | "" | |
"HI $0!" | [ "Bob", "Charles" ] | "Hi Bob!" |
"HI $first!" | { first: "Bob", second: "Charles" } | "Hi Bob!" |
Compute MD5 hash of string.
Name | Type | Description |
---|---|---|
value | str | string value |
Create a variable and MD5 hash it
var hashvar = "This is important"; string.hash(hashvar);
Get all indexes of the second string in the first string.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Get index of the second string in the first string.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Insert the second string into the first string at the specified index.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
index | num | insert position |
Check if first character in string is a control character.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a decimal digit.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a high surrogate (UTF-32).
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is an alphabetic character.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is an alphabetic character or decimal digit.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a lowercase letter.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a low surrogate (UTF-32).
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a number.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a punctation mark.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a separator character.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a surrogate character (UTF-32).
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is a symbol character.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is an uppercase letter.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if first character in string is white space.
Name | Type | Description |
---|---|---|
value | str | string value |
Join strings in a list using a specified separator.
Name | Type | Description |
---|---|---|
list | list | list of strings |
separator | str | (optional) separator used between strings (default: ", ") |
var lst = ["one","two","three","four","five"]; string.join(lst,",");
Get last index of the second string in the first string.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Get the length of the string.
Name | Type | Description |
---|---|---|
text | str | (optional) string value |
Match a string against a regular expression pattern and return the first match.
Name | Type | Description |
---|---|---|
text | str | string value |
pattern | str | regular expression pattern |
ignorecase | bool | (optional) ignore case (default: false) |
withIndex | bool | (optional) return text with index (default: false) |
Match a string against a regular expression pattern and return all matches.
Name | Type | Description |
---|---|---|
text | str | string value |
pattern | str | regular expression pattern |
ignorecase | bool | (optional) ignore case (default: false) |
withIndex | bool | (optional) return text with index (default: false) |
captures | bool | (optional) return capture groups instead of matched text (default: false) |
Replace every match the regular expression pattern with replacement value.
Name | Type | Description |
---|---|---|
text | str | string value |
pattern | str | regular expression pattern |
replacement | str | replacement value |
ignorecase | bool | (optional) ignore case (default: false) |
Non-breakable space.
string.nbsp; // Parenthesis not needed
Pad string with characters on the left until it reaches the specified width.
Name | Type | Description |
---|---|---|
text | str | string value |
width | num | total width (negative: relative to current length; positive: absolute length) |
padding | str | (optional) padding character (default: " ") |
Pad string with characters on the right until it reaches the specified width.
Name | Type | Description |
---|---|---|
text | str | string value |
width | num | total width (negative: relative to current length; positive: absolute length) |
padding | str | (optional) padding character (default: " ") |
Quote string and escape characters.
Name | Type | Description |
---|---|---|
text | str | string value |
Remove characters from a string the specified index.
Name | Type | Description |
---|---|---|
text | str | string value |
index | num | index to remove characters at |
count | num | (optional) number of characters to remove (default: all) |
Replaces all occurrences of a string with another string.
Name | Type | Description |
---|---|---|
text | str | string value |
before | str | old value |
after | str | new value |
ignorecase | bool | (optional) ignore case (default: false) |
Escape special characters in string.
Name | Type | Description |
---|---|---|
value | str | string value |
Convert a value into a string.
Name | Type | Description |
---|---|---|
value | any | (optional) value |
Split string at each occurrence of the separator up to the specified limit.
Name | Type | Description |
---|---|---|
text | str | string value |
separator | str | string separator |
max | num | (optional) maximum results (default: no limit) |
Split a string into a list and output it in a formatted <pre> tag
var brothers = "Marky, Ricky, Danny, Terry, Mikey, Davey, Timmy, Tommy, Joey, Robby, Johnny, Brian"; var lst = string.split(brothers,',',5); web.pre(lst);
Convert string into a collection of rows and columns.
Name | Type | Description |
---|---|---|
text | str | comma separated values |
Prepare a comma separated string for .CSV format
var brothers = "Marky, Ricky, Danny, Terry, Mikey, Davey, Timmy, Tommy, Joey, Robby, Johnny, Brian"; var lst = string.splitcsv(brothers); web.pre(lst);
Escape special SQL characters in string.
Name | Type | Description |
---|---|---|
value | str | string value |
Check if the first string starts with the second string.
Name | Type | Description |
---|---|---|
first | str | first string value |
second | str | second string value |
ignorecase | bool | (optional) ignore case (default: false) |
Extract a substring.
Name | Type | Description |
---|---|---|
text | str | string value |
start | num | sub-string start index |
length | num | (optional) sub-string length (default: remainder of string) |
Extract the word Customer Success
var str = "MindTouch Customer Success Center"; string.substr(str,10,16);
Convert first charater of each word in string to uppercase.
Name | Type | Description |
---|---|---|
text | str | string value |
var str = "here is my text, it is all lowercase"; string.tocamelcase(str);
Convert string to lowercase characters.
Name | Type | Description |
---|---|---|
text | str | string value |
var str = "THIS IS REALY LOUD!"; string.tolower(str);
Convert first character in string to lowercase.
Name | Type | Description |
---|---|---|
text | str | string value |
var str = "THIS IS REALY LOUD!"; string.tolowerfirst(str)
Convert string to uppercase characters.
Name | Type | Description |
---|---|---|
text | str | string value |
Convert first character in string to uppercase.
Name | Type | Description |
---|---|---|
text | str | string value |
Remove whitespace from the beginning and end of the string.
Name | Type | Description |
---|---|---|
text | str | string value |
Remove whitespace from the end of the string.
Name | Type | Description |
---|---|---|
text | str | string value |
Remove whitespace from the beginning of the string.
Name | Type | Description |
---|---|---|
text | str | string value |