| Previous | Contents | Index |
This function 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.
| Example 6-136 SCAN Function |
|---|
let a$ = 'Cameron Whitehorn' let b$ = 'amr Wtor' let position = scan(a$, b$) print position end 2 |
SKIP returns the position of the character following the last skipped character.
str_expr1 is the text string to be searched.
str_expr2 contains the list of characters which are to be skipped. If only one argument is given, SKIP will skip over spaces, tabs and nulls.
int_expr contains the search start position. This parameter is optional.
| Example 6-137 SKIP Function |
|---|
a$ = '31415 hello' z = skip(a$, '1234567890 ') print mid(a$, z) end hello |
The following are end user interface system functions that Sheerpower performs:
_BACK returns a TRUE or FALSE value. TRUE if the [esc]or the UP ARROW was pressed at the last prompt.
| Example 6-138 _BACK System Function |
|---|
message 'Press the Escape key or the Up Arrow key'
input 'Please enter your age' : age$
if _back then
print '_back is set to true'
end if
end
Please enter your age? [Esc] <---- press the Escape key
_back is set to true
|
_EXIT returns a TRUE or FALSE value. TRUE if EXIT was entered at the last prompt.
| Example 6-139 _EXIT System Function |
|---|
do
input 'Please enter your name' : name$
if _exit then
print '_exit is set to true'
exit do
end if
loop
end
Please enter your name? [Ctrl/Z] <------ hold down the Ctrl key, then press the Z key
_exit is set to true
|
_HELP returns a TRUE or FALSE value. TRUE if HELP or a question mark (?) was entered at the last prompt.
_HELP should be checked before _BACK and/or _EXIT because, in some cases, all three are set on. For example, if "EXIT" is the default and HELP is entered, both _HELP and _EXIT are set on.
| Example 6-140 _HELP System Function |
|---|
input 'Do you need help' : location$
if _help then
print '_help is set to true'
end if
end
Do you need help? help
_help is set to true
|
_REPLY returns the user's reply to the last prompt. The reply is returned as a string.
| Example 6-141 _REPLY System Function |
|---|
last$ = 'Enter new text'
do
line input area 5,10,15,50, default last$: text$
if _exit then exit do
last$ = 'You said ' + _reply
loop
end
|
The _TERMINATOR function returns the name of the key that terminated the last INPUT statement. The values returned are:
| UP | Up arrow | |
| DOWN | Down arrow | |
| ENTER | Enter |
F1, F2, F3, F4, F5, F7, F8, F9, F11, F12
| Example 6-142 _TERMINATOR System Function |
|---|
do
line input 'name': yourname$
if _exit then exit do
print 'Terminator was: '; _terminator
loop
end
name? [F3] <----- press the F3 key
Terminator was: F3
name? exit
|
VALID is used to validate user responses.
text_str is the text to be validated.
rule_str is the list of validation rules.
Multiple validation rules are separated by a semicolon. If given characters are NOT between quotes, they are to be uppercase.
VALID returns an error if there is an invalid validation rule.
'Illegal validation rule' (-4021)
|
VALID returns TRUE or FALSE according to the following validation rules:
| Example 6-143 Validation Rules - ALLOW |
|---|
text$ = 'ann'
vrule$ = 'allow ann, dan, tom'
number$ = '10'
vrules$ = 'number; allow 1 to 6; maxlength 2'
number2$ = '12'
vrules2$ = 'number; allow 1 to 24, 99'
if valid(text$, vrule$) then print 'true'
if not valid(number$, vrules$) &
then print 'false'
if valid(number2$, vrules2$) then print 'true'
end
true
false
true
|
| Example 6-144 Validation Rules - DISALLOW |
|---|
number$ = '10'
vrules$ = 'disallow 01, 03, 05; minlength 2'
if valid(number$, vrules$) &
then print 'true'
end
true
|
| Example 6-145 Validation Rules - MINLENGTH |
|---|
text$ = 'Hello there'
vrule$ = 'minlength 5'
if valid(text$, vrule$) &
then print 'true'
end
true
|
| Example 6-146 Validation rules - MAXLENGTH |
|---|
text$ = 'Hello'
vrule$ = 'maxlength 5'
if valid(text$, vrule$) &
then print 'true'
end
true
|
| Example 6-147 Validation Rules - LENGTH |
|---|
text$ = 'abcdefghijklmnopqrstuvwxyz'
vrule$ = 'length 26'
if valid(text$, vrule$) &
then print 'true'
end
true
|
| Example 6-148 Validation Rules - CHARACTERS |
|---|
text$ = 'abc123'
vrule$ = 'characters "abc123"'
if valid(text$, vrule$) &
then print 'true'
end
true
|
| Example 6-149 Validation Rules - NOCHARACTERS |
|---|
text$ = 'abc123'
vrule$ = 'nocharacters "def456"'
if valid(text$, vrule$) &
then print 'true'
end
true
|
| Example 6-150 Validation Rules - LETTERS |
|---|
text$ = 'It is a sunny day today'
vrules$ = 'letters'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-151 Validation Rules - LCASE |
|---|
text$ = 'hi there'
vrules$ = 'lcase'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-152 Validation Rules - UCASE |
|---|
text$ = 'HI THERE'
vrules$ = 'ucase'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-153 Validation Rules - DIGITS |
|---|
text$ = '983745'
vrules$ = 'digits'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-154 Validation Rules - DECIMALS |
|---|
text$ = '9837.45'
vrules$ = 'decimals 2'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-155 Validation Rules - NUMBER |
|---|
text$ = '100'
vrules$ = 'number'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-156 Validation Rules - INTEGER |
|---|
text$ = '2147483647'
vrules$ = 'integer'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| Example 6-157 Validation rules - INTEGER WORD |
|---|
text$ = '32767'
vrules$ = 'integer word'
if valid(text$, vrules$) &
then print 'true'
end
true
|
| DATE | YMD | YYMMDD format | |
| DATE | DMY | DDMMYY format | |
| DATE | MDY | MMDDYY format | |
| DATE | MDCY | MMDDCCYY format |
| Previous | Next | Contents | Index |