| Previous | Contents | Index |
Given the number of seconds since the INTOUCH base date, this function returns the date and time in one of the formats given below.
float_expr is the number of seconds since the INTOUCH base date. The default is the current date and time. January 1, 1600 00:00:00 is considered the second 0.
| Value (int_var) | Output Data Format |
|---|---|
| 0 | CCYYMDD HHMMSS |
| 1 | MMDDCCYY HHMMSS |
| 2 | DDMMCCYY HHMMSS |
| 3 | DD-Mon-CCYY HH:MM:SS |
| 4 | Month DD, CCYY HH:MM:SS |
10 PRINT FULLTIME$
20 sec = SECONDS('19910621 115042')
30 PRINT FULLTIME$(sec, 0)
40 PRINT FULLTIME$(sec, 1)
50 PRINT FULLTIME$(sec, 2)
60 PRINT FULLTIME$(sec, 3)
70 PRINT FULLTIME$(sec, 4)
80 END
RNH
19910621 123756
19910621 115042
06211991 115042
21061991 115042
21-Jun-1991 11:50:42
June 21, 1991 11:50:42
|
This function changes the plain text in str_expr1 into a hashed eight-byte string value. It can be used to develop one-way hashed passwords. The optional text in str_expr2 and optional int_expr can be used to further make the hashed value unique.
10 password$ = HASH$('TRUTH')
INPUT 'Password': pwd$
IF HASH$(pwd$) = password$ THEN
PRINT 'That was the correct password.'
ELSE
PRINT 'That was not the correct password.'
END IF
20 END
RNH
Password? MONEY
That was not the correct password.
|
INT returns the whole portion of a real number as a real number.
INTEGER changes any numeric expression into an integer value and assigns the integer value to the variable specified.
IP truncates the value of a real number at the decimal point and returns the integer portion.
The ITEM function returns the number of the first item that matches the whole or partial item name given. A negative number is returned if more than one item matches.
10 z = ITEM('ADD,EXIT,EXTRACT,MODIFY', 'MOD')
PRINT z
20 END
RNH
4
10 z = ITEM('ADD,EXIT,EXTRACT,MODIFY', 'EX')
PRINT z
20 END
RNH
-2
|
Given an array and a dimension number, returns the low bound for that dimension. The default dimension is 1.
LCASE returns a string expression with all letters in lower case.
LEFT$ returns the leftmost nn characters from a string. int_expr is the last character position to be included in the resulting string.
LEN returns the length of a string. It returns an integer.
LOG returns the natural logarithm of a specified number.
LOG2 returns a number's base 2 logarithm.
LOG10 returns a number's common logarithm.
LPAD$ pads a string on the left with pad characters. The default pad character is a space.
10 PRINT LPAD$('123', 6, '0')
20 END
RNH
000123
|
Removes all leading spaces (those on the left side of the string).
str_expr1 contains a list of elements separated by commas. str_expr2 contains a string. MATCH compares str_expr2 with each of the elements in str_expr1 and gives the number of the element that matches.
Quoted data is treated as one element; the quotes are not removed.
The TRUE parameter is used if the match is to be case-exact. The default is case-insensitive.
10 a$ = 'BLUE'
b$ = 'Blue'
c$ = a$
20 DO
x = MATCH('Red,White,Blue', c$, TRUE)
PRINT c$;
IF x > 0 THEN
PRINT ' is a match.'
ELSE
PRINT ' is not a match.'
c$ = b$
REPEAT DO
END IF
END DO
30 END
RNH
BLUE is not a match.
Blue is a match.
|
MAX(x,y) returns the larger of the two values x and y.
Returns the maximum number of characters that a string variable can contain. Since all string variables are variable length, with a maximum of 65535, this function always returns 65535.
Returns the largest number available in this implementation of INTOUCH.
Returns the total number of elements that can be contained in an array.
MID$ or MID returns a substring from the middle characters of a specified string, leaving the string unchanged. int_expr1 is the starting position of the substring, and int_expr2 is the length of the substring. MID$(str_expr,int_expr1) will return the rest of the string.
10 a$ = 'beginmiddleend'
middle$ = MID$(a$, 6, 6)
end$ = MID$(a$, 6)
PRINT middle$, end$
20 END
RNH
middle middleend
|
MIN(x,y) returns the lesser of the values x and y.
Gives the remainder of one number divided by another.
Given the ASCII name of a character, returns the location of that character in the ASCII character table. It returns an integer number.
Given the location of a character in the ASCII character table, returns the name of that character.
PARSE$ splits a string into tokens and returns each token separated by a space. Letters are upper-cased, except within quotes. Tail comments are ignored. Embedded "$" characters are allowed. Names/words can start with digits. The maximum line length is 1024 characters.
10 a$ = 'company$ = 123abc$ +"and sons" !rnn'
20 PRINT PARSE$(a$)
30 END
RNH
COMPANY$ = 123ABC$ + "and sons"
|
Matches any characters in text (str_expr1) with the pattern (str_expr2). str_expr1 is the text to search and str_expr2 is the pattern being searched for. Returns the location of the first character in the text that contains the pattern. If the characters cannot be found, returns zero.
PATTERN Options and Examples
Pattern options can be mixed and matched with unlimited complexity.
Matches any character in the text.
10 IF PATTERN('The quick brown fox', &
'f?x') > 0 THEN
PRINT 'Found'
END IF
20 END
RNH
Found
|
Matches one or more of a character that precedes the single asterisk
(*).
Matches zero or more of a character that precedes the double asterisk
(**).
10 IF PATTERN('aaa 03/26/92', 'a* *03/26/92') > 0 THEN
PRINT 'The date is found'
END IF
20 END
RNH
The date is found
|
Used to define a group of characters. The characters in the enclosed group can be ranges such as {a-z} or individual characters such as {AQX}.
10 text$ = 'A1N5V7N0'
rule_str$ = '{A-Z}{0-9}{A-Z}{0-9}{A-Z}{0-9}{A-Z}{0-9}'
IF PATTERN(text$, rule_str$) > 0 THEN
PRINT 'Driver's licence is correct'
END IF
20 END
RNH
Driver's licence is correct
|
Looks for characters that are NOT {^A-Z}. The result of line 30 below shows the difference between using '?' and {^}.
10 PRINT PATTERN('Mary J. Smith','{^Mar}')
20 PRINT PATTERN('Mary J. Smith','J. {^S}')
30 PRINT PATTERN('Mary J. Smith','J. S?')
40 END
RNH
4
0
6
|
The '~' (quote) character looks for a pattern of text that IS an * (stands for itself).
10 text$ = '$4,670.00'
IF PATTERN(text$, '$~4, 670.00') > 0 THEN
PRINT 'Your text is correct'
END IF
20 END
RNH
Your text is correct
|
Looks for text in str_expr1 that matches the enclosed groups.
10 text$ = 'The area code is 619'
IF PATTERN(text$, 'is {<619|714|916>}') > 0 THEN
PRINT 'Your area code is on the list'
END IF
20 END
RNH
Your area code is on the list
|
Looks for a match on a word. The word text can contain an embedded "$".
10 a$ = 'There are dogs and cats in the house.'
b$ = 'Everyone would like to make big$bucks!'
20 IF PATTERN(a$, '{(cats)}') > 0 THEN
PRINT 'The word was found.'
END IF
30 IF PATTERN(b$, '{(big$bucks)}') > 0 THEN
PRINT 'The $ word was found.'
END IF
40 END
RNH
The word was found.
The $ word was found.
|
Directives can be used with the PATTERN function. Multiple directives can be used. Directives are processed from left to right. The valid directives are:
| nocase | can be upper, lower or mixed case |
| case | unless NOCASE specified, default is CASE (i.e. case-exact) |
| bol | beginning of a line |
| eol | end of a line |
10 a$ = 'ElEpHaNtS have trunks'
b$ = 'water goes splash'
20 IF PATTERN(a$, '{|bol|}{|nocase|}elephants') > 0 THEN
PRINT 'elephants was found.'
END IF
30 IF PATTERN(b$, 'splash{|eol|}') > 0 THEN
PRINT 'splash was found.'
END IF
40 END
RNH
elephants was found.
splash was found.
|
Returns the value 3.141592653589793.
and
PIECE$ returns an element from str_expr1 specified by num_expr. str_expr1 contains a list of elements. The separator can be indicated by str_expr2. The default separator is a carriage-return line-feed pair.
These two functions are similar to the ELEMENTS() and ELEMENT$() functions except that:
10 CLEAR
MESSAGE 'Press GOLD/F when done'
LINE INPUT AREA 5, 10, 8, 60: text$
PRINT AT 10, 1: 'Rewrapped text'
wt$ = WRAP$(text$, 1, 30)
PRINT 'Number of lines: '; PIECES(wt$)
PRINT wt$
PRINT
PRINT 'First line was: '; PIECE$(wt$, 1)
20 END
|
POS searches for a substring within a string. It returns the substring's starting character position. str-exp1 is the string to be searched, str-exp2 is the substring to locate, and int-exp is the OPTIONAL character position at which to begin the search. (The default is the start of the string.) If the substring is not found, zero is returned.
PRETTY$ converts text so that the text displays on any terminal. Named control characters show up with their names. Other control characters show up as {X} where "X" is the letter to press or as {XX} where "XX" is the hexadecimal value of the character.
10 a$ = 'Hello' + CHR$(5) + CHR$(161) + CHR$(7)
20 PRINT PRETTY$(a$)
30 END
RNH
Hello{^E}{A1}{bel}
|
The QUOTE$ function encloses a string expression in double quotes. If the string expression is already enclosed in double quotes, QUOTE$ leaves it alone. If the string expression is already wrapped in single quotes, QUOTE$ replaces them with double quotes. Elements double quoted within the string expression are given another pair of double quotes (see following example). 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$
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!"
Quoted text using the QUOTE$ function...
"The little boy cried ""wolf!"""
|
Given a measurement in degrees, returns the number of radians.
REAL changes any numeric expression into a real or floating-point value and assigns the real value to the variable specified.
10 INPUT 'Your age': age%
LET decimal_age = REAL(age%)
PRINT 'Your number is'; decimal_age
20 END
|
REMAINDER(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.
Creates a string composed of the specified string repeated the specified number of times.
Searches for a list of patterns in the str_expr1 and replaces them with the output 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.
str_sep1 is the optional separator for replacement items. The default is a comma.
str_sep2 is the optional separator between the input and output text in items. Default is =.
10 text$ = '01-Mar-1981'
PRINT REPLACE$(text$, 'r=y 8=9' , ' ')
20 END
RNH
01-May-1991
|
RIGHT$ returns the rightmost characters from a string. int_exp is the character 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
|
or
RND returns a random number greater than or equal to zero and less than one. If a numeric expression (num_expr) is given, RND returns a whole number between one and the numeric expression.
ROUND rounds a num_expr to the specified number of decimal places (int_expr). The default int_expr is 0.
RPAD$ 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
|
Returns a string without any trailing spaces (those on the right side).
Scans str_expr1 for the characters in str_expr2 and returns the position at which str_expr2 begins. int_expr specifies a character position at which the search is to begin.
The 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
|
Returns a secant of a given angle (1/COS(num_expr)). num_expr is a passed angle.
Given a full-time string in CCYYMMDD HHMMSS, YYMMDD HHMMSS, HHMMSS or HHMM 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
|
Extracts the substring given a first and last character position.
Returns the sign of a number. It returns a +1 if the expression is positive, a -1 if the expression is negative, and 0 if the expression is zero.
SIN returns the sine of an angle specified in radians.
SINH(X) returns the hyperbolic sine X.
Returns the number of elements in one dimension of an array.
| array-name | Array to examine | |
| int-expr | Dimension to get the size of. The default dimension is 1. |
| Previous | Next | Contents | Index |