Vtech PreComputer Power Pad Plus User Manual - Page 57

String Functions

Page 57 highlights

Example: PRINT RND (19) press ENTER You will get a number between 1 and 19. RND (0) will give you a number between 0 and 1. Note: X cannot be negative. Important Note: From now on, the ENTER key sign will be deleted for simplicity. Remember to press the ENTER key after each line of entry. STRING FUNCTIONS We can also use functions to act on strings. Take a look at the following: LEN This function computes the length of the string argument, which must be in brackets. So if you type PRINT LEN ("JOHN") the computer will return the result 4. This is telling you that there are 4 characters in the string "JOHN". Blank spaces have the value of characters. Thus if you put in spaces "J O H N", it comes out as 7 characters. STR$ The STR$ function changes a number argument into a string. Take a look at the following example and see how it works. Example: A$=STR$(73) This is the same as saying A$="73". Here is a sample program. Type the next example: 10 A$=STR$(7*3) 20 B$=A$+"BIG" 30 PRINT B$ RUN 21BIG 53

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

53
Example:
PRINT RND (19)
press
ENTER
You will get a number between 1 and 19.
RND
(0) will give you a number between 0
and 1.
Note
:
X cannot be negative.
Important Note: From now on, the ENTER key sign will be deleted for simplicity.
Remember to press the ENTER key after each line of entry.
STRING FUNCTIONS
We can also use functions to act on strings.
Take a look at the following:
LEN
This function computes the length of the string argument, which must be in brackets.
So
if you type
PRINT LEN (“JOHN”)
the computer will return the result 4.
This is telling
you that there are 4 characters in the string “JOHN”.
Blank spaces have the value of
characters.
Thus if you put in spaces “J O H N”, it comes out as 7 characters.
STR$
The
STR$
function changes a number argument into a string.
Take a look at the following
example and see how it works.
Example:
A$=STR$(73)
This is the same as saying A$=“73”.
Here is a sample program.
Type the next example:
10
A$=STR$(7*3)
20
B$=A$+“BIG”
30
PRINT B$
RUN
21BIG