String Helper

The String Helper file contains handlers that assist in working with strings.

Loading this Helper

This helper is loaded using the following code:

rigLoadHelper "string"

The following handlers are available:


Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes.

The first parameter specifies the type of string, the second parameter specifies the length. The following choices are available:

Usage example:

put rigRandomString("alnum", 16) into tRandomString


Allows two or more items to be alternated between, when cycling through a loop. Example:

repeat with i = 1 to 10
	put rigAlternator("string one", "string two") after tAlternated
end repeat

Note: To use multiple separate calls to this function call the rigResetAlternator handler first.

You can add as many parameters as you want, and with each iteration of your loop the next item will be returned.

repeat with i = 1 to 10
	put rigAlternator("one", "two", "three", "four", "five") after tAlternated
end repeat


Generates repeating copies of the data you submit. Example:

put return into tString
put rigRepeater(tString, 30) into tRepeaatedString

The above would generate 30 newlines.


Converts double slashes in a string to a single slash, except those found in http://. Example:

put "" into tString
put rigReduceDoubleSlashes(tString) into tString -- results in ""


Removes any leading/trailing slashes from a string. Example:

put "/this/that/theother/" into tString
put rigTrimSlashes(tString) into tString -- results in this/that/theother


Reduces multiple instances of a particular character occuring directly after each other. Example:

put "Fred, Bill,, Joe, Jimmy" into tString
put rigReduceMultiples(tString,",") into tString -- results in "Fred, Bill, Joe, Jimmy"

The function accepts the following parameters:

rigReduceMultiples(string: text to search in, string: character to reduce, boolean: whether to remove the character from the front and end of the string)
The first parameter contains the string in which you want to reduce the multiples. The second parameter contains the character you want to have reduced. The third parameter is FALSE by default; if set to TRUE it will remove occurences of the character at the beginning and the end of the string. Example:
put ",Fred, Bill,, Joe, Jimmy," into tString
put rigReduceMultiples(tString, ",", TRUE) into tString -- results in "Fred, Bill, Joe, Jimmy"


Converts single and double quotes in a string to the corresponding HTML entities. Example:

put "Joe's" && quote & "dinner" & quote into tString
put rigQuotesToEntities(tString) into tString -- results in "Joe's "dinner""


Removes single and double quotes from a string. Example:

put "Joe's" && quote & "dinner" & quote into tString
put rigStripQuotes(tString) into tString -- results in "Joes dinner"