Previous Top Index Next

String Functions

ABBREV(information,info[,length])

tests whether info is an abbreviation of information. returns "1" on true, else returns "0". If length is specified then searching takes place only for the first length characters.
abbrev("billy","bill") /* 1 */
abbrev("billy","bila") /* 0 */
abbrev("billy","bila",3) /* 1 */

CENTRE(string,length[,pad])
CENTER(string,length[,pad])

returns string centered in a padded string of length length.
center("rexx",2) /* 'ex' */
center("rexx",8) /* ' rexx ' */
center("rexx",8,'-') /* '--rexx--' */

CHANGESTR(target,string,replace)

replaces all occurrences of the target in string, replacing them with the replace.
changestr("aa","aabbccaabbccaa","--") /* --bbcc--bbcc-- */

COMPARE(string1,string2[,pad])

returns "0" if string1==string2, else it returns the index of the first nonmatching character. Shorter string is padded with pad if necessary
compare('bill','bill') /* 0 */
compare('bill','big') /* 3 */
compare('bi ','bi') /* 0 */
compare('bi--*','bi','-') /* 5 */

COUNTSTR(target,string)
counts all the appearances of target in string

countstr("aa","aabbccaabbccaa") /* 3 */

COPIES(string,n)

returns n concatenated copies of string.
copies('Vivi',3) /* 'ViviViviVivi' */

DELSTR(string,n[,length])

delete substring of string starting at the nth character and of length length.
delstr('bill',3) /* 'bi' */
delstr('bill',2,2) /* 'bl' */

INDEX(haystack,needle[,start])

return the position of needle in haystack, beginning at start.
index('bilil','il') /* 2 */
index('bilil','il',3) /* 4 */

INSERT(new,target[,[n][,[length][,pad]]])

insert the string new of length length into the string target, after the nth character (n can be 0)
insert('.','BNV',2) /* 'BN.V' */
insert('.','BNV',2,2) /* 'BN. V' */
insert('','BNV',2,2,'.') /* 'BN..V' */

LASTPOS(needle,haystack[,start])

return the position of the last occurrence of needle in haystack, beginning at start.
lastpos('il','bilil') /* 4 */
lastpos('il','bilil',4) /* 2 */

LEFT(string,length[,pad])

return a string of length length with string left justified in it.
left('Hello',2) /* 'He' */
left('Hello,10,'.') /* 'Hello.....' */

LENGTH(string)

return the length of string
length('Hello') /* 5 */

OVERLAY(new,target[,[n][,[length][,pad]]])

overlay the string new of length length onto string target, beginning at the nth character.
overlay('.','abcd',2) /* 'a.cd' */
overlay('.','abcd') /* '.bcd' */
overlay('.','abcd',6,3,'+') /* 'abcd+.++' */

POS(needle,haystack[,start])

return the position of needle in haystack, beginning at start.
pos('ll','Bill') /* 3 */

REVERSE(string)

swap string, end-to-end.
reverse('Bill') /* 'lliB' */

RIGHT(string,length[,pad])

returns length righmost characters of string.
right('abcde',2) /* 'de' */

SUBSTR(string,n[,[length][,pad]])

return the substring of string that begins at the nth character and is of length length. Default pad is space.
substr('abcde',2,2) /* 'bc' */
substr('abcde',2) /* 'bcde' */
substr('abcde',4,3,'-') /* 'de-' */

STRIP(string[,[<"L"|"T"|"B">][,char]])

returns string stripped of Leading, Trailing, or Both sets of blanks or other chars. Default is "B".
strip(' abc ') /* 'abc' */
strip(' abc ','t') /* ' abc' */
strip('-abc--',,'-') /* 'abc' */

TRANSLATE(string[,[tableo][,[tablei][,pad]]])

translate characters in tablei to associated characters in tableo. If neither table is specified, convert to uppercase.
translate('abc') /* 'ABC' */
translate('aabc','-','a') /* '--bc' */
translate('aabc','-+','ab') /* '--+c' */

VERIFY(string,reference[,[option][,start]])

return the index of the first character in string that is not also in reference. if "Match" is given, then return the result index of the first character in string that is in reference.
verify('abc','abcdef') /* 0 */
verify('a0c','abcdef') /* 2 */
verify('12a','abcdef','m') /* 3 */

XRANGE([start][,end])

return all characters in the range start through end.
xrange('a','e') /* 'abcde' */
xrange('fe'x,'02'x) /* 'feff000102'x */


Previous Top Index Next