String package guide
Use String to copy, search, extract, split, compare, convert, and format text.
Version 2.17.1. Installed versions can differ. Examples are illustrative and not tested.
Quick example: String text = Price is 250 today ; Strip whitespace gives Price is 250 today, Extract text gives 250, and To number gives Number 250. For Replace Template, prepare Dictionary replacements with String entry name=world, then pass $replacements$.
Prerequisites
Run on the Device without another application or package session. In examples, an arrow binds an output to a variable of its listed type. String fields accept text and String references such as $text$; convert Number or Boolean references to text first. Dictionary and List inputs need matching variables. Supply required fields; references can give empty text where allowed. Optional inputs left out use table defaults.
Positions start at 0. Occurrence counts start at 1. Some emoji count as 2 characters; lengths and limits use this same count. Reverse keeps whole visible characters together. Positions and limits must be whole numbers. Boolean switches default to false; write Boolean values as lowercase true or false. Regex uses .NET patterns and stops after 5 seconds. Examples are editor entries, not automation JSON: enter backslashes directly.
Action index
| Action | Does |
|---|---|
| Assign | Copy or combine text. |
| Extract text | Keep text before, after or between other text. |
| Change text case | Change letter case. |
| Compare | Compare whole texts. |
| Escape for CSV | Escape one CSV field. |
| Escape for HTML | Encode HTML characters. |
| Escape for JSON | Escape JSON string contents. |
| Escape for XML | Encode XML characters. |
| Evaluate variable | Read references stored in text. |
| Find | Find a match position. |
| Length | Count characters. |
| Lowercase | Make letters lowercase. |
| Normalize space | Combine whitespace and trim. |
| Pad Text | Add padding to a length. |
| Generate random string | Generate test text, not passwords. |
| Replace | Replace text matches. |
| Replace Template | Fill Dictionary placeholders. |
| Reverse | Reverse visible characters. |
| Split | Split into a List. |
| Strip whitespace | Trim both ends. |
| Strip leading whitespace | Trim the start. |
| Strip leading zeroes | Remove leading zeros. |
| Strip trailing whitespace | Trim the end. |
| Substring | Keep a position range. |
| To boolean | Read true or false text. |
| To locale number | Read a locale-formatted number. |
| To number | Read a number with fixed rules. |
| Trim | Trim chosen ends. |
| Unescape for CSV | Decode one CSV field. |
| Unescape for HTML | Decode HTML entities. |
| Unescape for JSON | Decode JSON escapes. |
| Unescape for XML | Decode XML entities. |
| Uppercase | Make letters uppercase. |
| String condition | Check text in a branch. |
Shared fields
Actions link to the fields they use. Find and Replace use all four inputs; other linked actions use only Source string.
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Source string | Stringdefault ""required | Complete text to process. |
find | Find string | Stringdefault ""required | Literal text, or a .NET pattern with is. |
is | When finding | Booleandefault falseoptional | True distinguishes case; false ignores it. Literal matches use exact character values, not local language rules. |
is | The "find string" is | Booleandefault falseoptional | False: literal find. True: .NET pattern. A bad pattern or a match that takes over 5 seconds fails. |
| ID | Type | Meaning |
|---|---|---|
result | Type stated under Outputs. | The result of the action. |
Actions
Assign (stringAssign)
Copy or combine text and String variables. Empty source clears the destination.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Select the source string variable(s)/ value | Stringdefault ""optional | Complete template. String references resolve once before copying. Empty text is valid. |
Outputs
Returns result (String): the copied text.
Example
Prepare String variable x with b. Set sourceString=a$x$c. result → joined.
Expected result
joined is abc. A literal empty source returns "".
Extract text (stringBeforeAfter)
The start and end text are not kept. Occurrence counts include overlaps; a value below 1 uses 1.
| Choice | Keeps | Example |
|---|---|---|
BEFORE | Text after the start text. | is in Price is 250 today gives 250 today. |
AFTER | Text before the end text. | today gives Price is 250. |
BEFOREAFTER | Text between both. | is and today give 250. |
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Source string | Stringdefault ""optional | Text, possibly empty. |
get | Get characters | Getdefault BEFOREoptional | Choose from the table above. |
before | Start after text | Stringdefault ""optional | Start text for BEFORE; ignored otherwise. |
before | Occurrence | Numberdefault 1optional | Occurrence of before in the source. |
before | Start after text | Stringdefault ""optional | Start text in both-sides mode. |
before | Occurrence | Numberdefault 1optional | Start occurrence in both-sides mode. |
before | beforeAfterCondition | Beforedefault ANDoptional | For BEFOREAFTER: AND requires both anchors; OR accepts either and uses the source boundary for a missing side. |
after | End before text | Stringdefault ""optional | End text in both-sides mode. Search after the selected start text, or from source start if not found. |
after | Occurrence | Numberdefault 1optional | End occurrence, counted after the start text. |
after | End before text | Stringdefault ""optional | End text for AFTER, searched from source start; ignored otherwise. |
after | Occurrence | Numberdefault 1optional | Occurrence of after in the source. |
if | If no match found, return | Ifdefault SOURCEoptional | Fallback if anchors fail the requirement or ONLY requests too much: SOURCE returns unchanged source; EMPTY returns empty text. Cleanup switches do not apply. |
no | Number of characters to get | Nodefault ALLoptional | ALL: whole range. ONLY: exactly no from its start, or fallback if too short. UPTO: at most no. |
no | noOfChars | Numberdefault 0optional | characters for ONLY; use 0 or more. Negative gives an empty selection. Ignored in other length modes. |
no | noOfCharsUpto | Numberdefault 0optional | Maximum characters for UPTO, limited to 0 through extracted length. Ignored in other length modes. |
is | When extracting | Booleandefault falseoptional | True matches case of the start and end text; false ignores case. |
trim | Trim the extracted text (remove blank spaces) | Booleandefault falseoptional | True trims both ends after the length limit; keeps internal whitespace. |
remove | Remove Enter from the extracted text | Booleandefault falseoptional | True removes every CR and LF after trimming; keeps tabs and other internal spaces. |
Outputs
Returns result (String): extracted text or the selected fallback.
Example
Set sourceString=Price is 250 today, getCharacters=BEFOREAFTER, beforeStringInBeforeAfter=is (one trailing space), beforeOccurrenceInBeforeAfter=1, afterStringInBeforeAfter= today (one leading space), afterOccurrenceInBeforeAfter=1, beforeAfterCondition=AND, and noOfCharsToGet=ALL. Leave the three switches false. result → priceText.
Expected result
priceText is 250. Missing required anchor: SOURCE returns original text; EMPTY returns "". With OR, a missing start/end uses the source beginning/end. Empty anchors match at search start; an empty end anchor ends the range at its current start.
Change text case (stringChangeCase)
Change case with fixed rules, not the Device language. Sentence case changes the first letter of the whole text, not each sentence.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
text | Text to modify | Stringdefault ""required | Text to change. |
case | Case Option | Casedefault UPPERCASEoptional | UPPERCASE: uppercase. LOWERCASE: lowercase. TITLECASE: lowercase, then capitalize words. SENTENCECASE: lowercase, then capitalize the first letter found. |
Outputs
Returns result (String): changed text.
Example
Set text=hEllo wORld and caseOption=TITLECASE. result → titleText.
Expected result
titleText is Hello World. The same input gives HELLO WORLD with UPPERCASE, hello world with LOWERCASE, and Hello world with SENTENCECASE.
Compare (stringCompare)
Inputs
Uses Source string. First complete text.
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
string | Compare to string | Stringdefault ""required | Second complete text. |
match | When comparing | Booleandefault falseoptional | True matches case; false ignores case. Exact character comparison, not local language rules. Neither trims text. |
Outputs
Returns result (Boolean): true if the complete values are equal under the selected comparison; false otherwise.
Example
Set sourceString=abc, stringToCompare=ABC, and matchCase=false. result → same.
Expected result
same is true. With matchCase=true, it is false. Spaces and line breaks count in both modes.
Escape for CSV (stringEscapeCsv)
Quote one field that contains a comma, quote, CR or LF; double quotes inside it. This does not create a CSV file.
Inputs
Uses Source string: one field, not a row.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a,b. result → converted.
Expected result
converted is "a,b". Fields without a comma, quote, CR, or LF stay unchanged; embedded quotes are doubled.
Escape for HTML (stringEscapeHtml)
Replace special HTML text characters with entities.
Inputs
Uses Source string. Encoding does not make HTML safe.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to <b>&. result → converted.
Expected result
converted is <b>&: angle brackets and ampersand become entities.
Escape for JSON (stringEscapeJson)
Escape one JSON string's contents without adding outer double quotes.
Inputs
Uses Source string. Raw text. Quotes, backslashes, and control characters are escaped; objects are not serialized.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a"b. result → converted.
Expected result
converted is a\"b. The backslash is part of the result; no outer quotes are added.
Escape for XML (stringEscapeXml)
Inputs
Uses Source string. Raw XML text content. Replaces &, <, >, double quotes, and apostrophes; does not build or validate XML.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to <a>. result → converted.
Expected result
converted is <a>, text containing entities rather than an XML element.
Evaluate variable (stringEvaluate)
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Variable expression | Stringdefault ""required | Text or String reference. Binding resolves the outer reference; the action resolves those left in its text. Store literal references as data in the prepared variable. |
Outputs
Returns result (String): text after the additional resolution pass.
Example
Prepare String variable city with Paris and String variable v1 containing the literal text $city$. Set sourceString=$v1$. result → cityText.
Expected result
cityText is Paris. Only one extra pass runs. Unknown references remain text; declared variables without a value read as empty.
Find (stringFind)
Find the first literal or regular-expression match at or after a position.
Inputs
Also uses the Find and Replace fields.
Uses Source string. Positions refer to the original text.
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
start | Start from | Numberdefault 0optional | Position from 0. Negative uses 0; beyond source length returns -1. |
Outputs
Returns result (Number): zero-based match start, or -1 if absent.
Example
Set sourceString=hello world, find=o, startIndex=0, isCaseSensitive=false, and isRegularExpression=false. result → index.
Expected result
index is 4. With find=z, it is -1. With sourceString=order 42 shipped, find=[0-9]+, and isRegularExpression=true, it is 6.
Length (stringLength)
Count characters, including spaces and line breaks.
Inputs
Uses Source string. Text is not trimmed or changed.
Outputs
Returns result (Number): text length as a Number.
Example
Set sourceString=hello. result → length.
Expected result
length is 5. The emoji 😀 counts as 2 characters; the count can differ from what you see.
Lowercase (stringLowercase)
Make all letters lowercase, with fixed rules.
Inputs
Uses Source string. Numbers, punctuation and spaces stay.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to AbC. result → converted.
Expected result
converted is abc.
Normalize space (stringNormalizeSpace)
Collapse each whitespace run to one ordinary space, then trim both ends.
Inputs
Uses Source string. Spaces, tabs and line breaks count as whitespace; line layout is lost.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a b . result → converted.
Expected result
converted is a b. Whitespace-only input gives empty text; internal tabs and line breaks become spaces.
Pad Text (stringPad)
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
pad | Pad Direction | Paddefault LEFToptional | LEFT: before source; RIGHT: after source. |
source | Original text | Stringdefault ""required | Text to keep. |
pad | Text to pad | Stringdefault ""required | Repeated padding; the action automatically cuts the final repetition to the characters needed. |
final | Final length | Numberdefault 0optional | Total length, source included, 0 or more. A value no larger than the source keeps it unchanged. |
Outputs
Returns result (String): padded text.
Example
Set padDirection=LEFT, sourceText=a, padString=ab, and finalLength=5. result → padded.
Expected result
padded is ababa; padDirection=RIGHT gives aabab. A source already at or above final length is not truncated. Empty padding returns the source.
Generate random string (stringRandomString)
Generate sample text from English uppercase and lowercase letters and digits. Do not use it for passwords or security tokens.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
random | String length | Numberdefault 0optional | Whole length; negative uses 0. A large value uses that much memory. |
Outputs
Returns result (String): generated alphanumeric text.
Example
Set randomStringLength=12. result → sampleId.
Expected result
sampleId has exactly 12 characters from A-Z, a-z, and 0-9; text varies between calls. Length 0 or less gives "".
Replace (stringReplace)
Inputs
Also uses the Find and Replace fields.
Uses Source string. Positions refer to the original text.
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
start | Start from | Numberdefault 0optional | Zero-based position, limited to 0 through source length. Keeps the prefix; regex runs on the suffix, so ^ means suffix start. |
count | Count | Numberdefault -1optional | Maximum replacements; any negative means all, 0 changes nothing. |
replace | Replace with | Stringdefault ""optional | Empty deletes selected matches. Regex mode uses .NET replacement syntax, such as $1 for capture groups; literal mode treats it as ordinary text. |
Outputs
Returns result (String): text after replacement, including the unchanged prefix.
Example
Set sourceString=a-b-c, find=-, replaceWith=+, startIndex=0, count=1, and both matching switches false. result → replaced.
Expected result
replaced is a+b-c; count=-1 gives a+b+c. No match or a literal empty search keeps the source unchanged. Regex can match empty positions.
Replace Template (stringReplaceTemplate)
Replace exact double-braced keys with Dictionary values. Keys are case-sensitive; no surrounding whitespace is added.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
template | Template text | Stringdefault ""required | Text with placeholders such as {{name}}; name, Name, and name are different keys. |
dictionary | Dictionary with replacement values | Dictionarydefault {}required | Populated Dictionary, such as $replacements$. Keys identify placeholders; values supply stored text representations. String values gain no JSON quotes. |
Outputs
Returns result (String): template after replacements.
Example
Prepare Dictionary variable replacements with String entry name=world. Set templateString=Hello {{name}}! and dictionary=$replacements$. result → greeting.
Expected result
greeting is Hello world!. Unknown placeholders stay. Every known key is replaced, in Dictionary order. Inserted text containing another known placeholder can therefore be replaced later.
Reverse (stringReverse)
Reverse visible characters; an emoji or a letter with a combined accent stays together.
Inputs
Uses Source string.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to ab😀. result → converted.
Expected result
converted is 😀ba; the emoji stays intact at the start. Empty String gives empty text.
Split (stringSplit)
Split on a literal delimiter into a List of Strings. Keep empty fields, including the final one.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Source string | Stringdefault ""optional | Text to split; may be empty. |
delimiter | Delimiter | Stringdefault ""required | Literal separator, not regex; removed at each split. |
is | Delimiter is | Booleandefault falseoptional | True matches delimiter case; false ignores case. |
substrings | Split into substrings | Substringsdefault ALLoptional | ALL: split at every delimiter. ONLY: at most limit items; final item keeps the remaining source. |
limit | limit | Numberdefault 1optional | Maximum items for ONLY (not delimiters). Below 1 uses 1; ignored with ALL. |
Outputs
Returns result (List): ordered List of String items. $parts[0]$ reads the first item.
Example
Set sourceString=a,b,c, delimiter=,, isCaseSensitive=false, substrings=ONLY, and limit=2. result → parts.
Expected result
parts is ["a","b,c"]. With substrings=ALL, it is ["a","b","c"]. An empty source gives [""]; an empty delimiter or an absent delimiter produces one item containing the whole source.
Strip whitespace (stringStrip)
Trim whitespace at both ends; keep internal spacing.
Inputs
Uses Source string. Tabs and line breaks count; to combine internal whitespace, use Normalize space.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a . result → converted.
Expected result
converted is a. Whitespace-only input gives empty text; interior spaces stay.
Strip leading whitespace (stringStripLeading)
Remove leading whitespace only.
Inputs
Uses Source string. Tabs and line breaks count.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a . result → converted.
Expected result
converted is a ; both trailing spaces and internal whitespace stay.
Strip leading zeroes (stringStripLeadingZeroes)
Remove consecutive leading ASCII zeros.
Inputs
Uses Source string. Text operation: leading spaces or a sign stop removal; all-zero text becomes empty.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to 007. result → converted.
Expected result
converted is 7. Source 000 gives empty text; 007 stays 007 because of its leading space.
Strip trailing whitespace (stringStripTrailing)
Remove trailing whitespace only.
Inputs
Uses Source string. Tabs and line breaks count.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a . result → converted.
Expected result
converted is a; both leading spaces and internal whitespace stay.
Substring (stringSubString)
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Source string | Stringdefault ""optional | Complete source; may be empty for an empty range. |
start | Start from | Numberdefault 0optional | Whole position, 0 through source length. Negative does not count from the end. |
sub | Length | Numberdefault -1optional | Whole characters; any negative means the remainder. The range must fit completely, with no automatic truncation. |
return | Return blank if the range is not found | Booleandefault falseoptional | True returns empty text for an invalid range; false fails with a range error. |
Outputs
Returns result (String): selected text, or empty text for an invalid range when enabled.
Example
Set sourceString=Automation, startIndex=0, subStringLength=4, and returnBlankIfRangeNotFound=false. result → prefix.
Expected result
prefix is Auto. Length -1 takes the remainder. With sourceString=abc, startIndex=5, and subStringLength=2, the action fails unless returnBlankIfRangeNotFound=true, which gives "". Start at source length with length 0 is valid.
To boolean (stringToBoolean)
Parse true/false text, trimming outer whitespace and ignoring case.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Select string variable | Stringdefault ""required | String true or false in any case. To copy a Boolean variable, use the Boolean package. |
Outputs
Returns result (Boolean): parsed Boolean.
Example
Set sourceString=TRUE. result → enabled.
Expected result
enabled is true; false gives false. Text 1, 0, yes, empty text, and all other words cause a parse error.
To locale number (stringToLocaleNumber)
Read a number using a chosen locale or the Device language. Thousands separators and exponents follow that locale.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Source value | Stringdefault ""required | Locale-formatted number text; trims outer whitespace. Currency symbols are not enabled. |
locale | Number Format | Localedefault Deviceoptional | SPECIFIC: use locale. Device: use the running process's current Device culture; ignore locale. |
locale | Locale | Stringdefault ""optional | Locale name, such as de-DE, en-US or es-PE, only for SPECIFIC. Empty uses fixed rules; give a name to make the format clear. |
Outputs
Returns result (Number): parsed floating-point Number.
Example
Set sourceString=1.234,56, localeFormat=SPECIFIC, and locale=de-DE. result → amount.
Expected result
amount is 1234.56. Invalid locale names or unparseable text cause an error. Device can interpret the same text differently on another Device.
To number (stringToNumber)
Read a number with fixed rules, whatever the Device language.
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
source | Enter the string | Stringdefault ""required | Decimal point, optional sign and exponent, such as -42.5 or 1.2e3. Trims outer whitespace. |
Outputs
Returns result (Number): parsed floating-point Number.
Example
Set sourceString=42.5. result → value.
Expected result
value is 42.5; 1.2e3 gives 1200. Decimal commas, thousands separators, currency symbols, and other invalid numeric text cause a parse error.
Trim (stringTrim)
Inputs
Uses Source string. Text; whitespace includes spaces, tabs, and line breaks.
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
trim | Trim from the beginning | Booleandefault falseoptional | True with trim: start only. True with trim: both ends. |
trim | Trim from the end | Booleandefault falseoptional | True with trim: end only. Both false still trims both ends. |
Outputs
Returns result (String): trimmed text.
Example
Set sourceString to hi , trimAtBeginning=true, and trimAtEnd=false. result → trimmed.
Expected result
trimmed is hi , with two trailing spaces. Both false or both true gives hi. Internal spaces stay.
Unescape for CSV (stringUnescapeCsv)
Remove one outer pair of CSV double quotes; each doubled quote ("") inside becomes one (").
Inputs
Uses Source string: one encoded field, not a row.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to "a,b". result → converted.
Expected result
converted is a,b. Source "a""b" gives a"b; abc stays abc without outer quotes. Returns one field value, not a List.
Unescape for HTML (stringUnescapeHtml)
Decode named and numeric HTML character references.
Inputs
Uses Source string. Entity-encoded text. Output can contain literal markup; do not trust it as HTML.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to <b>. result → converted.
Expected result
converted is <b>, with literal angle brackets. No HTML document is rendered or validated.
Unescape for JSON (stringUnescapeJson)
Decode escaped JSON string contents without outer quotes.
Inputs
Uses Source string. String contents only. Invalid escapes and unescaped double quotes or control characters cause errors.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to a\"b. result → converted.
Expected result
converted is a"b; the escape backslash is removed. Invalid escape \q causes a JSON parse error.
Unescape for XML (stringUnescapeXml)
Decode XML entity and numeric references using the HTML decoder, including its named entities.
Inputs
Uses Source string. Entity-encoded text; does not parse XML, validate nesting, or remove markup.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to <a>. result → converted.
Expected result
converted is <a>, plain String content. XML element structure is not validated.
Uppercase (stringUppercase)
Make all letters uppercase, with fixed rules.
Inputs
Uses Source string. Numbers, punctuation and spaces stay.
Outputs
Returns result (String): the processed text.
Example
Set sourceString to abc. result → converted.
Expected result
converted is ABC.
Conditions
String condition (stringCondition)
Inputs
| ID | Editor field | Type; default; requirement | Use |
|---|---|---|---|
variable | Source value | Stringdefault ""optional | Source text, such as $status; may be empty. |
operator | Operator | Operatordefault EQoptional | EQ (Equals to (=)): complete equality; NEQ (Not equal to (≠)): inequality; INCLUDE (Includes): source contains target; NOTINCLUDE (Does not include): source does not contain target; STARTSWITH (Starts with): prefix; ENDSWITH (Ends with): suffix. |
value | Target value | Stringdefault ""optional | Target text for the chosen comparison; may be empty. |
match | Match case | Booleandefault falseoptional | True: exact, case-sensitive comparison. False: ignores case. |
is | Ignore carriage return | Booleandefault falseoptional | True removes every CR and LF from both values before comparison, despite the label. Spaces and tabs stay. |
Outputs
No output variables. Use the condition to choose a branch: true when the test succeeds, false otherwise.
Example
Set variable=Hello, operator=INCLUDE (Includes), value=ELL, matchCase=false, and isIgnoreCarriage=false.
Expected result
The condition is true; matchCase=true gives false. An empty target is contained in every source and is a prefix and suffix of every source.