M!INTOUCH® 4GL Y

INTOUCH® 4GL
A Guide to the INTOUCH Language

A
Previous page... 6Table of Contents


%Returns the value 3.141592653589793. 

'

PIECES(str_expr1 [,str_expr2])





and 

/

PIECE$(str_expr1,num_expr[,str_expr2])



KPIECE$ returns an element from str_expr1 specified by num_expr. Str_expr1 Kcontains a list of elements. The separator can be indicated by str_expr2. ;The default separator is a carriage-return line-feed pair. 

KThese two functions are similar to the ELEMENTS() and ELEMENT$() functions except that: 





        10 CLEAR -            MESSAGE 'Press GOLD/F when done' 0            LINE INPUT AREA 5, 10, 8, 60: text$ -            PRINT AT 10, 1: 'Rewrapped text' &            wt$ = WRAP$(text$, 1, 30) 3            PRINT 'Number of lines: '; PIECES(wt$)             PRINT wt$             PRINT 5            PRINT 'First line was: '; PIECE$(wt$, 1)         20  END 
.

POS(str_expr1, str_expr2[, int_expr])



JPOS searches for a substring within a string. It returns the substring's Estarting character position. Str-exp1 is the string to be searched, Kstr-exp2 is the substring to locate, and int-exp is the OPTIONAL character Hposition at which to begin the search. (The default is the start of the string.) 



PRETTY$(str_expr)



HPRETTY$ converts text so that the text displays on any terminal. Named Lcontrol characters show up with their names. Other control characters show Hup as {X} where "X" is the letter to press or as {XX} where "XX" is the $hexadecimal value of the character. 

9        10  a$ = 'Hello' + CHR$(5) + CHR$(161) + CHR$(7)         20  PRINT PRETTY$(a$)         30  END          RNH         Hello{^E}{A1}{bel} 


QUOTE$(str_expr)



KThe QUOTE$ function encloses a string expression in double quotes. If the Istring expression is already enclosed in double quotes, QUOTE$ leaves it Falone. If the string expression is already wrapped in single quotes, LQUOTE$ replaces them with double quotes. Elements double quoted within the Istring expression are given another pair of double quotes (see following Lexample). Elements single quoted within the string expression are ignored. 

        10  DO               CLEAR               PRINT AT 1,1: :              MESSAGE 'Enter a line of text to be quoted'               PRINT 'Text:' )              INPUT '', LENGTH 30: line$ 2              IF  _BACK  OR  _EXIT  THEN  EXIT DO -              IF  line$ = ''  THEN REPEAT DO         20    PRINT ?              PRINT 'Quoted text using the QUOTE$ function...' "              PRINT quote$(line$)               DELAY             LOOP         30  END          RNH         Text: '        ? The little boy cried "wolf!"         1        Quoted text using the QUOTE$ function... )        "The little boy cried ""wolf!""" 


RAD(num_expr)



?Given a measurement in degrees, returns the number of radians. 



REAL(num_expr)



HREAL changes any numeric expression into a real or floating-point value 6and assigns the real value to the variable specified. 

#        10  INPUT 'Your age': age% )            LET decimal_age = REAL(age%) 0            PRINT 'Your number is'; decimal_age         20  END 
(

REMAINDER(num_expr1, num_expr2)



IREMAINDER(x,y) returns the remainder when X is divided by Y. It differs <subtly from MOD. MOD(-4,3) = 2 while REMAINDER(-4,3) = -1. 

$

REPEAT$(str_expr, int_expr)



ICreates a string composed of the specified string repeated the specified number of times. 

>

REPLACE$(str_expr1, str_expr2 [,str_sep1][,str_sep2])



LSearches for a list of patterns in the str_expr1 and replaces them with the Goutput string from str_expr2. Returns the replaced string expression. 

/Str_expr1 is a list of patterns to search for. 

#Str_expr2 is the replacement list. 

JStr_sep1 is the optional separator for replacement items. The default is a comma. 

OStr_sep2 is the optional separator between the input and output text in items. Default is =. 

"        10  text$ = '01-Mar-1981' 3            PRINT REPLACE$(text$, 'r=y 8=9' , ' ')         20  END                                RNH         01-May-1991 
%

RIGHT[$](str_expr, int_expr)



KRIGHT$ returns the rightmost characters from a string. The int_exp is the Icharacter position of the last character to be included in the substring COUNTING FROM THE RIGHT. 

'        10  ans$ = RIGHT$('Daniel', 2) ,            PRINT 'rightmost char.= ', ans$         20  END          RNH         rightmost char.= el 

RND





or 



RND(num_expr)



HRND returns a random number greater than or equal to zero and less than Gone. If a numeric expression (num_expr) is given, RND returns a whole /number between one and the numeric expression. 

%

ROUND(num_expr [, int_expr])



BROUND rounds a num_expr to the specified number of decimal places ((int_expr). The default int_expr is 0. 

(

RPAD$(text_str, size[,pad_str])



GRPAD$ pads a string on the right with pad characters. The default pad character is a space. 

'        10  PRINT RPAD$('123', 6, '0')         20  END          RNH         123000 


RTRIM$(str_expr)



HReturns a string without any trailing spaces (those on the right side). 

0

SCAN(str_expr1, str_expr2 [, int_expr])



LScans str_expr1 for the characters in str_expr2 and returns the position at Jwhich str_expr2 begins. Int_expr specifies a character position at which the search is to begin. 

HThe characters in str_expr2 need not appear contiguously in str_expr1. 

)        10  LET a$ = 'Cameron Whitehorn'              LET b$ = 'amr Wtor' (            LET position = SCAN(a$, b$)             PRINT position         20  END          RNH 
        2 


SEC(num_expr)



KReturns a secant of a given angle (1/COS(num_expr)). Num_expr is a passed angle. 



SECONDS(str_expr)



FGiven a full-time string in CCYYMMDD HHMMSS, YYMMDD HHMMSS, HHMMSS or GHHMM format, returns the number of seconds since the INTOUCH base date (January 1, 1600 00:00:00). 

>The number of seconds is returned as a floating point number. 

,        10  z  = SECONDS('19931201 103050') *            z1 = SECONDS('931201 103050') #            z2 = SECONDS('103050') !            z3 = SECONDS('1030') )        20  PRINT 'Seconds CYMDHMS ='; z *            PRINT 'Seconds  YMDHMS ='; z1 *            PRINT 'Seconds     HMS ='; z2 *            PRINT 'Seconds     HM  ='; z3         30  END          RNH &        Seconds CYMDHMS = 12430837850 &        Seconds  YMDHMS = 12430837850          Seconds     HMS = 37850          Seconds     HM  = 37800 
-

SEG$(str_expr, int_expr1, int_expr2)



BExtracts the substring given a first and last character position. 



SGN(num_expr)



NReturns the sign of a number. It returns a +1 if the expression is positive, Ea -1 if the expression is negative, and 0 if the expression is zero. 



SIN(num_expr)



7SIN returns the sine of an angle specified in radians. 



SINH(num_expr)



'SINH(X) returns the hyperbolic sine X. 

%

SIZE(array_name [,int_expr])



=Returns the number of elements in one dimension of an array.         F  
array-name Array to examine
int-expr Dimension to get the size of. The default dimension is 1.


3

SKIP(str_expr1 [, str_expr2] [, int_expr])



FSKIP returns the position of the character following the last skipped character. 

-Str_expr1 is the text string to be searched. 

CStr_expr2 contains the list of characters which are to be skipped. KIf only one argument is given, SKIP will skip over spaces, tabs and nulls. 

JInt_expr contains the search start position. This parameter is optional. 

        10  a$ = '31415 hello' (            z = SKIP(a$, '1234567890 ')         20  PRINT mid(a$, z)         30  END          RNH         Hello 
&

SORT$(str_expr1 [,str_expr2])



JSorts the elements from a str_expr1 in ASCII value order. Returns a list of the sorted elements. 

9Str_expr1 contains the list of elements to be sorted. 

9Str_expr2 is an optional separator. Default is a comma. 

         10  a$ = 'code area is' %            a_sort$ = SORT$(a$, ' ')             PRINT a_sort$         20  END          RNH         area code is 


SPACE$(num_expr)



4Returns the number of spaces indicated by num_expr. 



SQR(num_expr)



)SQR returns the square root of a number. 



STR$(num_expr)



GSTR$ changes a number to a numeric string. The string that is created 4does not have any extra leading or trailing spaces. 



SYSTEXT$





or 



SYSTEXT$(int_expr)



FSYSTEXT$ returns the text associated with the operating system status Ispecified. If no int_expr is supplied, INTOUCH returns the text for the last system status. 



TAB(int_expr)



IWhen used with the PRINT statement, the TAB function moves the cursor or 4print mechanism to the right to a specified column. 



TAN(num_expr)



BTAN returns the tangent of an angle that is specified in radians. 



TANH(num_expr)



@Returns the hyperbolic tangent of the numeric expression given. 



TIME(int_expr)



JThe value returned by the TIME function depends on the value of int_expr. 

DIf int_expr = 0, TIME returns the number of seconds since midnight. 

IIf int_expr = 1, TIME returns the CPU time of the process in tenths of a second. 

NIf int_expr = 2, TIME returns connect time of the current process in minutes. 



TIME$





or 



TIME$(num_expr)



GIf num_expr is NOT specified, TIME$ returns the current time of day in HH:MM:SS format. 

JNum_expr is the number of seconds since midnight. The result is returned in HH:MM format. 

        10  PRINT TIME$(1800)             PRINT TIME$(54178)         20 END          RNH         00:30         15:02 


TIME(5)



LReturns the number of seconds since INTOUCH was invoked. This function can 1be used to time events to the nearest 100th/sec. 



TRIM$(str_expr)



LReturns the string specified stripped of any leading or trailing spaces and tabs. 

%        10  LET a$ = '    HELLO    '         20  PRINT '*'; a$; '*' &        30  LET stripped$ = TRIM$(a$) &        40  PRINT '*'; stripped$; '*'          RNH         *    HELLO    *         *HELLO* 

TRUE



7Returns the constant 1. It is returned as an integer. 

%

TRUNCATE(num_expr, int_expr)



=Truncates a real number to a given number of decimal places. 

(

UBOUND(array_name [, int_expr])



HGiven an array and a dimension number, returns the upper bound for that Fdimension. It returns an integer value. The default dimension is 1. 



UCASE$(str_expr)



BUCASE returns a string expression with all letters in upper case. 



UNQUOTE$(str_expr)



EThe UNQUOTE$ function removes one set of quotes from a quoted string Iexpression. If the string expression is not quoted, UNQUOTE$ leaves the Dstring alone. UNQUOTE$ does not affect internally quoted elements. 

        10  DO               CLEAR               PRINT AT 1,1: <              MESSAGE 'Enter a line of text to be unquoted'               PRINT 'Text:' )              INPUT '', LENGTH 50: line$ 2              IF  _BACK  OR  _EXIT  THEN  EXIT DO .              IF  line$ = ''  THEN  REPEAT DO         20    PRINT D              PRINT 'Quotes removed using the UNQUOTE$ function...' $              PRINT UNQUOTE$(line$)               DELAY             LOOP         100 END          RNH         Text: 7        ? "I will not take these 'things' for granted"  6        Quotes removed using the UNQUOTE$ function... 3        I will not take these 'things' for granted 


VAL(num_str)



:VAL returns the floating-point value of a numeric string. 

"

VALID(text_str, rule_str)



*VALID is used to validate user responses. 

&Text_str is the text to be validated. 

*Rule_str is the list of validation rules. 

NMultiple validation rules are separated by a semi-colon. If given characters /are NOT between quotes, they are upper-cased. 

@VALID returns an error if there is an invalid validation rule. 

*        'Illegal validation rule' (-4021) 


IVALID returns TRUE or FALSE according to the following validation rules: 



.

WRAP$(str_expr, int_expr1, int_expr2)



HReturns a word-wrapped text string, given left and right margins. Each .line of the string is separated with a CR/LF. 

BWhere string_expr = text string to wrap, int_expr1 = left margin, int_expr2 = right margin. 

%

XLATE$(str_expr1, str_expr2)



LThe XLATE$ function translates one string to another by referencing a table Kyou supply. For example, the XLATE$ function can translate from EBCDIC to GASCII. The first str_expr is the string to be translated. The second #str_expr is the translation table. 

4


Next page... | 6Table of Contents