Strings


Literal strings or characters used as arguments to these functions must be surrounded by single quotes, '...'. For example: isalpha('r2d2'). These functions do not modify their arguments; they return values based on those arguments.

Name -- Syntax / Description
asciichar
asciichar( number )
Returns the character corresponding to ascii character code in number. (number must be less than 255).
asciivalue
asciivalue( character )
Returns the ASCII numeric value for character (character must be a single character).
gettoken
gettoken( delimited_string, characters, position_num )
Returns the nth number token (i.e. substring) of a delimited_string using characters as token separators. A null string is returned if there is no nth token. Common delimiter characters are comma, tab, linefeeds, pipe but are not limited to these.
Returns the position_num token (i.e. substring) of a delimited_string delimited by characters.
  • delimited_string = A string delimited by a character or characters
  • characters = the delimiter character or characters
  • position_num = the position of the substring you want to return
glosub
glosub( target_string, search, replace )
Global substitution returns a copy of string in which all instances of string search have been replaced by string replace. (Note: to represent a backslash () in replace, use '\').
Returns string where all instances of search have been replaced.
  • target_string = the target string
  • search = the sub-string that will be search ed for
  • replace = the replacement string
glosub_array
glosub_array( string, search, replace )
Works like glosub(), but search and replace are arrays that are iterated through, each value in the search array found in the string is replaced by the corresponding replace array value.
unknown.
  • string = the target array
  • search = the sub-string that will be searched for
  • replace = the replacement string
indexof
indexof( search_string, target_string var, start_number )
Returns the position of the first occurrence of search_string within the target_string beginning at the start_number position. The search is CASE SENSITIVE sensitive. If not found, the functions return 0. The offset parameter and returned string offset are 1-based. For speed, target_string is passed by reference .
Returns the 1 based offset_number of search_string within the target_string. The search is case sensitive.
  • search_string = the string that will be searched for
  • target_string = the string that will be searched
  • start_number = the 1 based starting offset withing the target_string where the search will begin
indexofi
indexofi( search_string, target_string var, start_number )
Returns the position of the first occurrence of search_string within the target_string beginning at the start_number position. The search is CASE IN-SENSITIVE. If not found, the functions return 0. The offset parameter and returned string offset are 1-based. For speed, target_string is passed by reference
Returns the 1 based offset_number of search_string within the target_string. The search is case in-sensitive.
  • search_string = the string that will be searched for
  • target_string = the string that will be searched
  • start_number = the 1 based starting offset withing the target_string where the search will begin
keyword_extract
keyword_extract( string, keywords var )
Given a string, will extract keywords from it. Skipping SGML tags and stemming words (e.g., "running" becomes "run", but "bring" is not changed), the unique list of keywords are placed in the keywords as an array. Also, some common english words (the articles, "for" "are", etc.) are removed. Note that there are some words may stem unexpectedly (e.g., "has" transforms to "ha").
Populates the keywords array and returns number of elements.
keyword_extract_merge
keyword_extract_merge( string, weight )
Extracts keywords as described in keyword_extract, but inserts them into a persistent array initialized by keyword_extract_merge_init. The weight value passed in is associated with the results from the current string being analyzed. Return null.
Returns null.
keyword_extract_merge_init
keyword_extract_merge_init()
Initializes persistent storage for a multiple calls to keyword_merge_extract. Note that this persistent storage is usable for multiple calls within a running Miva Script program, and is deleted by the VM at the end of program execution.
Returns null.
keyword_extract_merge_results
keyword_extract_merge_results( keywords var )
Returns results from one or more keyword_extract_merge calls, storing them as an aggregate in "keywords".
Returns null.
keyword_in
keyword_in( keywords_array var, search_string )
Performs a keyword_extract() on the "string" parameter, and determines if the value in the "keywords" parameter is contained in the keyword list, and returns a boolean "1" or "0" to signify that the keyword is or is not in the string. If the "keywords" parameter is an array of strings, checks each value in the array, and returns an array of booleans specifying whether the array element is or is not in the string.
If keywords is an array, returns an array of booleans specifying if a given keyword element is in the keyword list. -- If keywords is a string, returns a boolean specifying if the given keyword is in the keyword list.
len
len( string )
Returns the number of characters in string.
The length of string.
  • string = a literal string value embedded in single quotes or an expression that evaluates as a string.
len_var
len_var( string var )
Returns the number of characters in string. This function is identical to len() but its parameter is passed by reference, improving performance when dealing with large strings.
the length of the string
  • string = a literal string value embedded in single quotes or an expression that evaluates as a string.
ltrim
ltrim( string )
Returns a copy of string with all space characters removed from the left end.
padl
padl( string, length, character )
Returns a string length characters long, consisting of string padded on the left with as many instances of padcharacter as are needed to make up the full length.
padr
padr( string, length, character )
Returns a string length characters long, consisting of string padded on the right with as many instances of padcharacter as are needed to make up the full length.
rtrim
rtrim( string )
Returns a copy of string with all space characters removed from the right end.
substring
substring( string, position, length )
Returns the substring of string, beginning at position start, length characters long.
substring_var
substring_var( string var, position, length )
Returns the substring of string, beginning at position start, length characters long. This function is identical to substring() but its first parameter is passed by reference, improving performance when dealing with large strings.
tokenize
tokenize( string, variables )
Returns the string, concatenated with the value of each token contained in replacements. Replacements is an array of structures, each with a token and a value.
tolower
tolower( string )
Returns a copy of string in lower case.
toupper
toupper( string )
Returns a copy of string in upper case.
trim
trim( string )
Returns the value of string with leading and trailing spaces removed
User Annotations: strings