Previous | Contents | Index |
COS returns the cosine of an angle the user specifies in radians.
COSH returns the hyperbolic cosine of a passed real number.
COT(X) is equivalent to 1/TAN(X).
CPAD$ returns a new string, padded on the left and on the right with pad characters. text_str is the string to be centered, size is the size of the new string. The default pad character is a space.
10 PRINT CPAD$('123', 9, '0') 20 END RNH 000123000 |
CSC(x) is the cosecant of X. It is shorthand for 1/SIN(x).
Returns today's date in YYDDD format.
The DATE$ function returns the date in image format. int_expr1 is a given Julian day number, the default is today's date. int_expr2 indicates the desired output format for the date. The Julian day---the number of days since January 1, 1600.
Value (int_expr2) | Output Date Format |
---|---|
0 | YYYYMMDD format |
1 | MMDDYYYY format |
2 | DDMMYYYY format |
3 | dd-Mon-yyyy format |
4 | Month dd, yyyy format |
PRINT DATE$(123456) - gives 19380104 | | | year mo day PRINT DATE$ - gives today's date 19960417 | | | year mo day PRINT DATE$(123456,1) - gives 01041938 | | | mo day year PRINT DATE$(123456,2) - gives 04011938 | | | day mo year PRINT DATE$(123456,3) - gives 04-Jan-1938 PRINT DATE$(123456,4) - gives January 4, 1938 |
To print today's date in a suitable format for a letter heading, you can use:
PRINT DATE$(DAYS(DATE$),4) - gives April 17, 1996 |
Given a date in CCYYMMDD or YYMMDD format, returns the number of days since January 1, 1600 (this date is day 1). This number is called the Julian day.
10 PRINT DAYS('19930403') 20 PRINT DAYS('930403') 30 END RNH 143634 143634 |
int_num indicates the desired input format for the date. The default input format is zero. If the century is not included, it assumes 1900 as the century.
Value (int_num) | Input Date Format |
---|---|
0 | CCYYMMDD or YYMMDD |
1 | MMDDCCYY or MMDDYY |
2 | DDMMCCYY or DDMMYY |
3 | DD-Mon-CCYY or DD-Mon-YY |
4 | Month DD, CCYY |
10 PRINT DAYS('19930403',0) PRINT DAYS('04031993',1) PRINT DAYS('03041993',2) PRINT DAYS('03-Apr-1993',3) PRINT DAYS('April 3, 1993',4) 20 END RNH 143634 143634 143634 143634 143634 |
Given an integer expression specifying the number of days since January 1, 1600, DAY$ returns the day of the week. If no integer expression is given, DAY$ returns the day of the week for today's date. The day is returned as a string expression (Friday, Saturday, etc.).
Given the string representation of a number and the base that the value is in (int_expr), INTOUCH returns the value in base 10. The number is returned as a real number.
Given an angle in radians, returns the number of degrees.
The DIV0 function divides num_expr1 by num_expr2. If num_expr2 (divisor) is 0, 0 is returned.
10 PRINT DIV0(0.8, 0.000004) PRINT DIV0(0.8, 0.0) PRINT DIV0(6, 3) PRINT DIV0(6, 0) 20 END RNH 200000 0 2 0 |
The DTYPE function returns as an integer value, the data type of an expression or dynamic variable: 1 = string, 2 = integer, 3 = real.
10 DECLARE DYNAMIC x 20 x = 45.6 30 PRINT DTYPE(x) 40 END RNH 3 |
EDIT$ performs one or more editing operations, depending on the value of the integer expression, on the supplied string argument. The integer expression is one of the integers below, or a sum of integers below for the desired edit functions:
Value | Edit Operation |
---|---|
1 | Trim parity bits. |
2 | Discard all spaces and tabs. |
4 | Discard characters: CR, LF, FF, ESC, RUBOUT and NULL. |
8 | Discard leading spaces and tabs. |
16 | Reduce spaces and tabs to One space. |
32 | Convert lower case to upper case. |
64 | Convert "[" to "(" and "]" to ")". |
128 | Discard trailing spaces and tabs. |
256 | Do not alter characters inside quotes. |
Returns the number of elements in a string expression which contains a list of elements. str_expr1 is the string containing the list of elements. str_expr2 is the separator. A comma is the default separator.
ELEMENT$ returns the element from str_expr1 which is specified by the num_expr. str_expr1 contains a set of elements with separators between them. The default separator is a comma:
10 LET a$ = ELEMENT$('ADD,DEL,EXIT',2) 20 PRINT a$ 30 END RNH DEL |
You can specify a separator other than the comma with str_expr2.
10 LET sentence$ = 'This is a test.' 20 LET a$ = ELEMENT$(sentence$,2,' ') 30 PRINT a$ RNH is |
More than one separator in a row returns a null for the corresponding element.
10 LET sentence$ = 'This,, is, a, test' PRINT ELEMENT$(sentence$, 2) 20 END RNH |
Returns a string containing a number converted to the base specified. num_expr is the value to convert. num_int is the base to convert. For instance, '2' indicates binary, etc.
INTOUCH carries 15 digits of precision. The EPS(number) returns the smallest value, which when added to "number" yields the next number.
This function evaluates the expression described in str_expr, and returns the result. If the variable being assigned the result is dynamic, the function puts the result in whatever data type the expression result was in. If the variable is NOT dynamic, and the result is the wrong data type, a "Data type mismatch" error is returned.
10 LINE INPUT 'Enter an expression': a$ PRINT 'The result is '; EVAL(a$) 20 END RNH Enter an expression? 5 + 4 The result is 9 |
EXLABEL$ returns the label and line number executing when the last exception occurred, e.g., DO_INPUT.4
EXLINE returns the line number executing when the last exception occurred.
EXP function returns the value of the mathematical constant, "e", raised to a specified power.
EXTEXT$ returns explanatory text associated with a specified exception number.
EXTYPE returns the number of the last exception that occurred. It is returned as an integer.
Returns the constant 0. It is returned as an integer.
FILESPEC$ parses a file specification and returns either a full file specification or specific file specification fields.
str_expr1 is the file specification to be parsed. If no file specification is given, the device and directory you are currently running from are returned.
str_expr2 is a list of field names, separated by commas, which are to be returned. The field names are:
DEVICE | device name | |
DIRECTORY | directory name | |
NAME | file name | |
TYPE | type or extension name | |
VERSION | file version number | |
LOCATION | device and directory names | |
ALL or "" | full file specification |
str_expr3 is the default file specification. This parameter is optional.
FILESPEC$ can be used in various formats.
10 PRINT FILESPEC$('x.y', 'ALL') PRINT FILESPEC$('', 'ALL') 20 END RNH USER:[FRED]X.Y; USER:[FRED].; |
10 x$ = 'TTI_RUN:CLIENT' PRINT FILESPEC$(x$, 'ALL', '.dat') 20 END RNH STORAGE:[INTOUCH]CLIENT.DAT; |
10 PRINT FILESPEC$('tti_run:client', 'ALL', '.dat') PRINT FILESPEC$('tti_run:client', 'LOCATION') PRINT FILESPEC$('tti_run:client', 'LOCATION, NAME') PRINT FILESPEC$('tti_run:client.dat;1') 20 END RNH STORAGE:[INTOUCH]CLIENT.DAT; STORAGE:[INTOUCH] STORAGE:[INTOUCH]CLIENT STORAGE:[INTOUCH]CLIENT.DAT;1 |
Given a file name to find, returns the complete file specification of the first file found that matches the name given. If no file is found, the function returns a null string.
FINDFILE$ calls can be nested if the inner call has only one argument (i.e., the file specification, but no index number).
str_expr | The name of the file to search for. This can be just part of the full file specification. | |
int_expr | Which file specification to return if multiple files are found. This parameter is optional. The default is to return the first file found. | |
result | The complete file specification of the file found. |
10 PRINT FINDFILE$('tti_run:*.int') RNH DUA0:[INTOUCH]ALIENS.INT;5 |
10 DO LINE INPUT 'File.Spec': spec$ IF _EXIT THEN EXIT DO FOR i = 1 TO 9999 file$ = FINDFILE$(spec$, i) IF file$ = '' THEN EXIT FOR PRINT file$ NEXT i LOOP 20 END RNH File specification? TTI_RUN:CLIENT.* DUA0:[INTOUCH]CLIENT.DAT;7 DUA0:[INTOUCH]CLIENT.DEF;3 DUA0:[INTOUCH]CLIENT.INT;1 DUA0:[INTOUCH]CLIENT.SAV;1 DUA0:[INTOUCH]CLIENT.STR;16 |
Given an expression and a format, returns the result of the expression in the format indicated.
The '@' format character causes the character not to be translated by the formatter. The '<' and '>'are treated like an '@' character. You can justify a character string, but avoid zero suppression and zero insertion.
The FORMAT$ function takes an expression of any data type for the data to format (the first argument), including string expressions.
10 z$ = FORMAT$('1234567', '###~-####') PRINT 'Phone number: '; z$ 20 END RNH Phone number: 123-4567 |
The FORMAT$ function returns all asterisks "*" in the case of overflow.
10 z$ = FORMAT$(12.23,'#.##') PRINT z$ 20 END RNH **** |
FORMAT$() returns the same string data as given by the following:
PRINT USING str_expr: expr |
The FORMAT$ function supports the DATE format and date arguments. Given a date in YYMMDD or CCYYMMDD format, FORMAT$ returns the date in the date format requested.
FORMAT$(z$, '{DATE [argument]}?') |
The ? can be replaced with a mask. If no date argument is provided, the default is MDCY.
10 z1$ = FORMAT$('960401', '{DATE MDCY}?') z2$ = FORMAT$('960401', '{DATE MDCY}##/##/####') z3$ = FORMAT$('19960401', '{DATE MDCY}?') z4$ = FORMAT$('19960401', '{DATE MDCY}##/##/####') 20 PRINT z1$, z2$ PRINT z3$, z4$ 30 END RNH 04011996 04/01/1996 04011996 04/01/1996 |
DATE Argument |
YYMMDD Input |
Result | CCYYMMDD Input |
Result |
---|---|---|---|---|
none | 960207 | 02071996 | 19960207 | 02071996 |
YMD | 960207 | 960207 | 19960207 | 960207 |
CYMD | 960207 | 19960207 | 19960207 | 19960207 |
MDY | 960207 | 022196 | 19960207 | 022196 |
MDCY | 960207 | 02071996 | 19960207 | 02071996 |
DMY | 960207 | 070296 | 19960207 | 070296 |
DMCY | 960207 | 07021996 | 19960207 | 07021996 |
DMONY | 960207 | 07-Feb-96 | 19960207 | 07-Feb-96 |
DMONCY | 960207 | 07-Feb-1996 | 19960207 | 07-Feb-1996 |
MONTHDY | 960207 | February 7, 96 | 19960207 | February 7, 96 |
MONTHDCY | 960207 | February 7, 1996 | 19960207 | February 7, 1996 |
The FORMAT$ function supports character rotation. The ROTATE option rotates the last nn characters of a string to the first position in the string.
FORMAT$(z$, '{ROTATE n}?') |
The ? can be replaced with a mask.
10 z1$ = FORMAT$('5552527800', '{ROTATE 3}?') z2$ = FORMAT$('5552527800', '{ROTATE 3}###~ ###~-####') z3$ = FORMAT$('TuneTommy', '{ROTATE 5}?') z4$ = FORMAT$('TuneTommy', '{ROTATE 5}#####~ ####') 20 PRINT z1$, z2$ PRINT z3$, z4$ 30 END RNH 8005552527 800 555-2527 TommyTune Tommy Tune |
The FORMAT$ function supports the TIME format. Given a military standard time in HHMM, HH:MM, HHMMSS or HH:MM:SS format, FORMAT$ returns the time as HH:MM AM/PM or HH:MM:SS AM/PM.
FORMAT$(z$, '{TIME}?') |
10 t1$ = FORMAT$('1022', '{TIME}?') t2$ = FORMAT$('19:45:36', '{TIME}?') 20 PRINT t1$ PRINT t2$ 30 END RNH 10:22 AM 07:45:36 PM |
The FORMAT$ function supports the ZIPCODE format. Given a 5, 6 or 9 digit zipcode, FORMAT$ returns a formatted zipcode.
FORMAT$(z$, '{ZIPCODE}?') |
10 z1$ = FORMAT$('92126', '{ZIPCODE}?') z2$ = FORMAT$('K8A3P9', '{ZIPCODE}?') z3$ = FORMAT$('931327845', '{ZIPCODE}?') 20 PRINT '5 character zipcode : '; z1$ PRINT '6 character zipcode : '; z2$ PRINT '9 character zipcode : '; z3$ 30 END RNH 5 character zipcode : 92126 6 character zipcode : K8A 3P9 9 character zipcode : 93132-7845 |
Given a number, returns the fractional part of the number.
Previous | Next | Contents | Index |