StrIns

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]


StrDel

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]+1" [name]

EndIf


StrLen

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]


SubStr

Purpose:

Copy a portion of a string.

Category:

Strings

Syntax:

SubStr "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]:


SubStr "John Quincy Adams" 5 6 [MiddleName]


SearchStr

Purpose:

Search for characters within a text string.

Category:

Strings

Syntax:

SearchStr "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 0 (zero) 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"

SearchStr " " "[Sentence]" "[SpacePos]"

While [SpacePos] > 0

 StrDel "[Sentence]" [SpacePos] 1 [Name]

 SearchStr " " "[Sentence]" [SpacePos]

EndWhile


StrUpper

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]


StrLower

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]


StrReplace

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] ""


StrParse

Purpose:

Separate a string into multiple parts using a delimiter character.

Category:

Strings

Syntax:

StrParse "source string" "delimiter" "array variable"

source string

The string containing the information to parse.

delimiter

The character (or characters) used to separate the elements of the string.

array 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]


When executed, an array based on the [Names] variable will be created. Each element in the array will contain one name.


StrTrim

Purpose:

Remove whitespace characters from both ends of a string.

Category:

Strings

Syntax:

StrTrim "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]


StrTrimLeft

Purpose:

Remove whitespace characters from the beginnig of a string.

Category:

Strings

Syntax:

StrTrimLeft "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]


StrTrimRight

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]


StrCompare

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]
source string 1 and 2

Strings to compare.

result var

Variable to store the result.

Example:

StrCompare "JOHN" "john" [result var]


CharToUnicode

Purpose:

Convert a character to its Unicode number.

Category:

Strings

Syntax:

CharToUnicode "char" [result var]

char

A simgle character.

result var

Variable to store the unicode number.

Example:

CharToUnicode "A" [myvar]


UnicodeToChar

Purpose:

Convert a Unicode number to a character.

Category:

Strings

Syntax:

UnicodeToChar number [result var]
number

A Unicode number.

result var

Variable to store the character with that Unicode number.

Example:

UnicodeToChar 65 [myvar]