Previous Next Chapter

CENTER()

CENTER(string,length[,pad])

CENTRE()

CENTRE(string,length[,pad])

Centers the string argument in a string with the specified length. If the length is longer than that of the string, pad characters or blanks are added as necessary. For example:

SAY CENTER(`abc',6) -> ` abc `
SAY CENTER(`abc',6,'+') -> `+abc++'
SAY CENTER (`123456',3) -> `234'

CLOSE()

CLOSE(file)

Closes the file specified by the given logical name. The returned value is a Boolean success flag and will be 1 unless the specified file was not open. For example:

SAY CLOSE(`input') -> 1

Compares two strings and returns the index of the fist position in which they differ or 0 if the strings are identical. The shorter string is padded as required using the supplied character or blanks. For example:

COMPARE()

COMPARE(string1,string2[,pad])

SAY COMPARE(`abcde', `abcce') -> 4
SAY COMPARE(`abcde', `abcde') -> 0
SAY COMPARE(`abc++', `abc+-`, `+') -> 5

COMPRESS()

COMPRESS(string[,list])

If the list argument is omitted, the function removes leading, trailing or embedded blank characters from the string argument. If the optional list is supplied, it specifies the characters to be removed from the string. For example:

SAY COMPRESS(` why not `) -> whynot
SAY COMPRESS(`++12-34-+', `+-`) -> 1234

COPIES()

COPIES(string,number)

Creates a new string by concatenating the specified number of copies of the original. The number argument may be zero, in which case the null string is returned. For example:

SAY COPIES(`abc',3) -> abcabcabc

Creates a string whose value is the binary (packed) representation of the given decimal number. For example:

D2C()

D2C(number)

D2C(65) -> A

Converts a decimal number to hexadecimal. For example:

D2X()

D2X(number[,digits])

D2X(31) -> 1F

If only the string argument is specified, DATATYPE() tests whether the string parameter is a valid number and returns either NUM or CHAR. If an option keyword is given, the Boolean return indicates whether the string satisfied the requested test. The following option keywords are recognized:

DATATYPE()

DATATYPE(string[,option])

ALPHANUMERIC

BINARY

LOWERCASE

MIXED

NUMERIC

SYMBOL

UPPER

WHOLE

X

For example:

SAY DATATYPE(`123') -> NUM
SAY DATATYPE(`1a f2', `X') -> 1
SAY DATATYPE(`aBcde', `L') -> 0

Returns the current date in the specified format. The default (`NORMAL') option returns the date in the form DD MMM YYYY, as in 20 APR 1988. The options recognized are:

DATE()

DATE([option][,date][format])

BASEDATE

CENTURY

DAYS

EUROPEAN

INTERNAL

JULIAN

MONTH

NORMAL

ORDERED

SORTED

USA

WEEKDAY

These options can be shortened to just the first character.

The DATE() functions also accepts optional second and third arguments to supply the date either in the form of internal system days or in the `sorted' form YYYYMMDD. The second argument is specifying either system days (the default) or a sorted date. The third argument specifies the form of the date and can be either `I' or `S'. The current date in system days can be retrieved using DATE(`INTERNAL'). For example:

SAY DATE() -> 14 Jul 1992
SAY DATE(`M') -> July
SAY DATE(S) -> 19920714
SAY DATE(`S' ,DATE(`I')+21) -> 19920804
SAY DATE(`W' ,19890609, `S') -> Friday

DELSTR()

DELSTR(string,n[,length])

Deletes the substring of the string argument beginning with the nth character for the specified length in characters. The default length is the remaining length of the string. For example:

SAY DELSTR(`123456',2,3) -> 156

DELWORD()

DELWORD(string,n[,length])

Deletes the substring of the string argument beginning with the nth word for the specified length in words. The default length is the remaining length of the string. The deleted string includes any trailing blanks following the last word. For example:

SAY DELWORD(`Tell me a story',2,2) -> `Tell story'
SAY DELWORD(`one two three',3) -> `one two `

Returns the current Numeric Digits setting. For example:

DIGITS()

DIGITS()

NUMERIC DIGITS 6
SAY DIGITS() -> 6

Checks the specified logical file name and returns the Boolean value 1 (True), if the end-of-file has been reached, and 0 (False) otherwise. For example:

EOF()

EOF(file)

SAY EOF(infile) -> 1

Top Previous Next Chapter