531
Format 2: Translation Table in Variable
TBL(string$,tbl_var$[,ERR=stmtref])
Use this format if the translation table to convert the string$ is in a variable.
Format 3: Translate Using Position
TBL(position,expr_0[$],expr_1[$] ... ,expr_n[$][,ERR=stmtref])
Use this format to obtain a value based on the numeric value of an expression. The
value the TBL( ) function returns depends on the value of position. If it's 0 zero, then
the value of expr_0 will be returned, if 1, then expr_1 will be returned, and so on.
Note: The values for expr_0[$], expr_1[$], ...n[$] can be either string or numeric. The
only requirement is that they must be all the same: all string or all numeric.
Format 4: Character to Character Conversion
TBL(var$,compare$,table$)
Use this format to do a character-to-character conversion of a string. ProvideX
replaces each character in the string variable that matches a character in the first
comparison string expression with the corresponding character from the table. That
is, when a character in the string variable matches a character in compare$, then:
· compare$ character 1 is replaced by table$ character 1 in var$,
· compare$ character 2 is replaced by table$ character 2 in var$,
· compare$ character 3 is replaced by table$ character 3 in var$,
· and so on.
Examples
Example 1:
T$="W"
P$=TBL(POS(T$="DWM"),"???","Daily","Weekly","Monthly")
?P$
Weekly
Example 2:
PRINT "Expires:",TBL(EXP_DT$="",EXP_DT$,"Never")
If EXP_DT$ is null, the logical expression EXP_DT$=" " yields 1. A null date will
print "Never". Otherwise, it yields 0 zero and the value of EXP_DT$ is printed. In
effect, this form of TBL( ) becomes: TBL(logical_expr, else_value,true_value).
Example 3:
let string$="ABCDEFG 123"
newstring$=tbl(string$,"ACF ","123_") ! newstring$ is "1B2DE3G_123"