Strings
Purpose: |
Insert characters into a string. |
Category: |
Strings |
Syntax: |
StrIns "source string" "dest string" "insert position" "variable" source string The characters to be inserted. dest string The destination string. insert position The position in dest string where the characters will be inserted, starting in 0 (zero). variable The name of a variable to store the modified string. |
Example: |
The following example will insert the contents of the variable [Name] into a string and store the result in a variable called [Greeting]: StrIns "[Name]" "Hello . How are you?" 6 [Greeting] |
Purpose: |
Delete characters from a string. |
Category: |
Strings |
Syntax: |
StrDel "source string" "start position" "length" "variable" source string The original string containing the characters to delete. start position The position of the first character to delete. length The number of characters to delete. variable The name of a variable to store the modified string. |
Example: |
The example below searches for spaces in the string assigned to the variable [name] and if found removes all characters that follow. The modified string is placed back into the [name] variable: SetVar [name] "John Doe" SearchStr " " "[Name]" [SpacePos] If [SpacePos] > "0" StrLen "[Name]" [Len] StrDel "[Name]" [SpacePos] "[Len]-[SpacePos]" [name] EndIf |
Purpose: |
Calculate the length of a string. |
Category: |
Strings |
Syntax: |
StrLen "string" "variable" string The string to examine. variable The name of a variable to store the string’s length. |
Example: |
In the example below, the variable [Name] contains the string "Bernard". Since this string contains seven characters, the example Action will place “7” into the variable [Size]: StrLen "[Name]" [Size] |
Purpose: |
Copy a portion of a string. |
Category: |
Strings |
Syntax: |
StrCopy "source string" "start position" "length" "variable" source string The original string containing the characters to copy. start position The position of the first character to copy. length The number of characters to copy. variable The name of a variable to store the copied text. |
Example: |
The example below, copies this president’s middle name (Quincy) into a variable called [MiddleName]: StrCopy "John Quincy Adams" 5 6 [MiddleName] |
Purpose: |
Search for characters within a text string. |
Category: |
Strings |
Syntax: |
StrSearch "search for" "string" "variable" search for The characters to find. string The text string to search. variable The name of a variable to store the position of the found characters. The variable will contain -1 if the characters are not present in the string. |
Example: |
The following example searches for and removes all spaces from the variable [Sentence]: SetVar [Sentence] "This is a multiple word phrase" StrSearch " " "[Sentence]" "[SpacePos]" While [SpacePos] > 0 StrDel "[Sentence]" [SpacePos] 1 [Sentence] SearchStr " " "[Sentence]" [SpacePos] EndWhile |
Purpose: |
Convert the contents of a string to upper case. Numbers and punctuation within the string are not affected. |
Category: |
Strings |
Syntax: |
StrUpper "string" "variable" string The string to convert. variable The name of a variable to store the modified string. |
Example: |
StrUpper "good dog" [Result] |
Purpose: |
Convert the contents of a string to lower case. Numbers and punctuation within the string are not affected. |
Category: |
Strings |
Syntax: |
StrLower "string" "variable" string The string to convert. variable The name of a variable to store the modified string. |
Example: |
StrLower "GOOD DOG" [Result] |
Purpose: |
Replace all occurrences of a character or substring within a string. |
Category: |
Strings |
Syntax: |
StrReplace "string" "old chars" "new chars" "variable" "options" string The original string. old chars The characters to replace. new chars The replacement characters. variable The name of a variable to store the modified string. options Enter "CaseSensitive" here to search using the exact characters entered. Leave this parameter blank to perform a case insensitive search (upper and lower case characters are treated the same). |
Example: |
The following example replaces each occurrence of the word "dog" in the source string with "cat": StrReplace "My dog is a good dog." "dog" "cat" [Result] "" You can also use this Action to remove a character by leaving the replacement characters parameter empty. For example: StrReplace "My doggy is a good doggy." "gy" "" [Result] "" |
Purpose: |
Separate a string into multiple parts using a delimiter character. |
Category: |
Strings |
Syntax: |
StrParse "source string" "delimiter" "variable" source string The string containing the information to parse. delimiter The character (or characters) used to separate the elements of the string. variable The name of the variable array to store the parsed elements. Each element in the string must be separated by the delimiter character (semicolon, comma, hyphen, etc.). StrParse will use the delimiter to divide the source string into individual elements which are placed into an array based on the array variable. The count variable will be set to the number of elements stored in the array. |
Example: |
The example below takes a list of names separates each one into individual names: SetVar [List] "Peter,John,Olivia,Bruce,Dana" StrParse "[List]" "," [Names] .-> John AlertBox "" "[Names(1)]" "" When executed, an array based on the [Names] variable will be created. Each element in the array will contain one name. |
Purpose: |
Remove whitespace characters from both ends of a string. |
Category: |
Strings |
Syntax: |
StrTrim "source string" [variable] source string The string to trim. variable The name of a variable to store the modified string. |
Example: |
SetVar [MyString] " John " StrTrim "[MyString]" [MyTrimmedString] |
Purpose: |
Remove whitespace characters from the beginnig of a string. |
Category: |
Strings |
Syntax: |
StrTrimLeft "source string" [result var] The string to trim. result var The name of a variable to store the modified string. |
Example: |
SetVar [MyString] " John" StrTrim "[MyString]" [MyTrimmedString] |
Purpose: |
Remove whitespace characters from the end of a string. |
Category: |
Strings |
Syntax: |
StrTrimRight "source string" [result var] source string The string to trim. result var The name of a variable to store the modified string. |
Example: |
SetVar [MyString] "John " StrTrim "[MyString]" [MyTrimmedString] |
Purpose: |
Determine if two strings are equal without case sensitivity. Returns true if strings match or false if they don't. |
Category: |
Strings |
Syntax: |
StrCompare "source string 1" "source string 2" [result var] Strings to compare. result var Variable to store the result. |
Example: |
StrCompare "JOHN" "john" [result var] |
Purpose: |
Convert a character to its Unicode number. |
Category: |
Strings |
Syntax: |
CharToUnicode "char" [result var] char A single character. result var Variable to store the unicode number. |
Example: |
CharToUnicode "A" [myvar] |
Purpose: |
Convert a Unicode number to a character. |
Category: |
Strings |
Syntax: |
UnicodeToChar number [result var] A Unicode number. result var Variable to store the character with that Unicode number. |
Example: |
UnicodeToChar 65 [myvar] |
Purpose: |
Encode a variable value to Base64 format. |
Category: |
Strings |
Syntax: |
EncodeToBase64 [var name] [result var] Variable whose value will be encoded. result var Variable to store the Base64 encoded value. |
Example: |
EncodeToBase64 [unencodedVar] [encodedVar] |
Purpose: |
Decode a Base64 string into its original value. |
Category: |
Strings |
Syntax: |
DecodeFromBase64 [var name] [result var] Variable whose value is Base64 encoded. result var Variable to store the unencoded value. |
Example: |
DecodeFromBase64 [encodedVar] [unencodedVar] |
Purpose: |
Convert a string into a URL encoded string. |
Category: |
Strings |
Syntax: |
StrEncodeURI [var name] [result var] Variable whose value will be encoded. result var Variable to store the URI encoded value. |
Example: |
StrEncodeURI [unencodedVar] [encodedVar] |
Purpose: |
Convert a URL encoded string into a decoded one. |
Category: |
Strings |
Syntax: |
StrDecodeURI [var name] [result var] Variable whose value is URI encoded. result var Variable to store the unencoded value. |
Example: |
StrDecodeURI [encodedVar] [unencodedVar] |
Created with the Personal Edition of HelpNDoc: Revolutionize Your Documentation Output with a Help Authoring Tool