home *** CD-ROM | disk | FTP | other *** search
-
- **************************************
-
- INSTR for the C-128
-
- **************************************
-
-
- INSTR. In-string. This command
-
- provides a fast way of searching for
-
- one string in another string, and
-
- may be considered a function.
-
- For example, in the statement
-
- P=INSTR(A$,B$), if B$ is found
-
- within A$, then P will equal the
-
- number of the position in which B$ is
-
- found. If it is not found, then P
-
- equals zero.
-
- Let's look at an example:
-
- 10 A$="ABCDEFGHIJK"
- 20 B$="DEF"
- 30 P=INSTR(A$,B$)
- 40 PRINT P
-
-
- In this case, P will equal four
-
- because B$ was found starting at the
-
- fourth posistion of A$.
-
- There is one more thing we can add
-
- to the INSTR variable. We can tell it
-
- not to start looking until part way
-
- through A$. In the example program
-
- above, for instance, if we change
-
- line 30 to P=INSTR(A$,B$,5), the
-
- program will not start looking until
-
- it gets to the fifth position, or the
-
- letter E. As a result, P will equal
-
- zero because the program will not
-
- find "DEF."
-
- Some examples of how this function
-
- might be used are contained in the
-
- programs KEYWORDS.128 and MONTH
-
- INPUT.128 on side one of this issue of
-
- Loadstar.
-
- KEYWORDS.128 is a small example of
-
- keeping track of articles by title
-
- and the magazine in which they
-
- appeared. By entering certain key
-
- words, such as BOOT or RENUMBER, the
-
- program will find articles that have
-
- the keywords in their title and the
-
- magazine in which they appeared. For
-
- example, if you entered RENUMBER as
-
- your keyword, then you might find:
-
- BASIC RENUMBER--COMMODORE APR/MAY 1985
-
- MONTH INPUT.128 is another example
-
- of the INSTR function. By inputting
-
- a month in the form of JAN, FEB, etc..
-
- the computer will tell you the actual
-
- number of that month. For example, if
-
- you enter 'NOV', then the computer
-
- will respond with 'The number of the
-
- month is 11".
-
- ------
-
- This program is copyrighted by
-
- PowerPlay magazine. All rights to it
-
- are reserved. LOADSTAR has relieved
-
- you from the burden of keying in this
-
- program. For more complete
-
- information about this program, refer
-
- to the January 1986 issue of PowerPlay
-
- Magazine.
-
- --------------------------------------
-