DIM (string function)
Dimension String Function
This string function creates a temporary string variable, with no name, of a specified length with an optional preset value for use in comparisons.
Syntax
Section titled “Syntax”DIM (length [,value] [,ERR=line-ref|,ERC=error-code])length- is an integer in the range of 0 to 65000 specifying the number of characters represented by this function.
value- is any string whose value is repeated to the length specified; if omitted, the default is space.
line-ref- is the program line number or label to branch to if an error is produced by this function.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Remarks
Section titled “Remarks”Specifying a length of 0 effectively represents a null string (string with no data and 0 length).
Examples
Section titled “Examples”IF STRING4$ = DIM (LEN (STRING4$), "ABCD")tests STRING4$ for the character sequence “ABCD”. STRING4$ = “A”, “AB”, “ABC”, “ABCD”, “ABCDA”, “ABCDAB”, (etc.), evaluate as true conditions.
IF UNKNOWN$ = DIM (LEN (UNKNOWN$), "*")tests UNKNOWN$ for all asterisks, regardless of the length of UNKNOWN$.
IF MAYBE_SPACES$ = DIM (LEN (MAYBE_SPACES$) )tests MAYBE_SPACES$ for all spaces, regardless of its length.
See also
Section titled “See also”DIM numeric array, DIM string array, and DIM string directives
PAD function
From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF