green text is being edited and should not be considered
relevant to the tutorial. for a while, it will make up
the bulk of this section.
black text has been edited to be more accurate with
regards to puppybasic.
........................................................................
strings part i: the indispensable
1 of 7
an intro to puppybasic
chapter 5: strings part i
........................................................................
........................................................................
strings part i: the indispensable
2 of 7
although you need to talk to the computer to write a program, and you
usually need math to talk to the computer, you usually need strings
(which may contain plain english) to talk to the person using the
computer. for this and other reasons, strings are generally as vital to
your program as numbers. here are some statements to work with strings:
UCASE$
q$=UCASE$(q$) will convert q$ to an all uppercase copy of itself. the
lowercase version is:
........................................................................
........................................................................
strings part i: the indispensable
3 of 7
LCASE$
q$=LCASE$(q$) when you've printed "press q to quit" can be the
difference between a person being able to exit your program when they
want to and being able to a bit later (when someone points out that
their caps lock light is on.) it is possible to turn off someone's caps
lock for them using program code, but processing strings with LCASE$ is
easier and more considerate.
_________________________________
q$="NAME@PUPPY.Com": PRINT LCASE$(q$) _name@puppy.com__________________
_________________________________
........................................................................
........................................................................
strings part i: the indispensable
4 of 7
CHR$ is indispensable: there are 256 different ASCII characters, (for
example, the lowercase letter "a" is ASCII 97, and a space, like from
the spacebar, is ASCII 32.) including letters, numbers, punctuation, and
other fun symbols (ASCII 01 is a smiley face. ☺ for the most part, the
only way to produce some of them is with CHR$. for instance, if you want
to produce a double quote on the screen, or within a string, you can use
the following code: (put it all on the same line, of course...)
? "i have been learning about puppybasic from "+CHR$(34)+"an intro to
puppybasic"+CHR$(34)+" and it's okay..."
...as ASCII 34 is the same double quote you would get from the keyboard.
........................................................................
........................................................................
strings part i: the indispensable
5 of 7
+------+---------------------------------------------------------------+
| CHR$ | also lets you "print" shadows and lines using text symbols... |
+------+---------------------------------------------------------------+
the reverse of CHR$, the ASC function, gives you the code number for the
first byte of a string:
? ASC("a") -3 _________________________________________________________
will print: __94_____________________________________________________
_________________________________________________________
as ascii 97, in puppybasic coded as: CHR$(97) is "a", and 97 -3 is 94.
........................................................................
........................................................................
strings part i: the indispensable
6 of 7
LEN... n = LEN(q$) will set n to a number equal to the number of bytes
in a string - examples: LEN("hello") is equal to 5, LEN("how are you?")
is equal to twelve. spaces and punctuation count.
lastly, as you can convert a string to a number using VAL, you can
convert a number to a string using STR$ so:
sp = 5
q$ = "you pressed spacebar" + STR$(sp-1) + "times."
will store the string: "you pressed spacebar 4 times." in q$.
........................................................................
........................................................................
strings part i: the indispensable
7 of 7
you are well on your way to learning puppybasic! the best thing you can
do with this tutorial is read it slowly, think about each page and what
kind of program you could write with each command, and experiment with
the code in puppybasic (type it in, you learn faster that way, even
though you *could* cut and paste...) for a feel of what coding is really
like.
and never forget to have fun.
-= end of chapter 5 =-
........................................................................
an intro to puppybasic (chapter 5)
this content is public domain.
........................................................................
click here to go back to the contents page
Before You Post, Please Note...
-> Please Note: By Posting, you agree to submit the contents of your post to the Public Domain <- SEE: howto post to this blog
Friday, February 2, 2007
puppybasic intro ch. 05 - strings part i
Subscribe to:
Post Comments (Atom)
28 comments:
buy tramadol online buy tramadol online no prescription next day delivery - tramadol for dogs taste
generic xanax xanax overdose cat - taking xanax recreational use
cheap generic xanax xanax drug test job - how many xanax 1 mg to get high
buy tramadol online is it legal to buy tramadol online us - buy tramadol legally
tramadol online dosage for tramadol for dogs - tramadol dosage veterinary medicine
xanax online no prescription xanax anxiety forum - pill report for xanax
buy tramadol online buy tramadol online australia no prescription - tramadol hcl hydrocodone
carisoprodol 350 mg buy carisoprodol cod - picture of carisoprodol 350 mg
cheapest xanax xanax withdrawal gabapentin - 9 panel drug test xanax
carisoprodol 350 mg carisoprodol online cheap - generic drug carisoprodol
can you buy tramadol online legally tramadol hcl high erowid - order tramadol online usa
xanax online xanax withdrawal addiction - generic xanax online no prescription
buy tramadol online do you withdrawal tramadol - tramadol 50mg hcl tablets
cialis online generic cialis 5mg - cialis online test
cialis for sale cheap cialis once day - cialis black
xanax medication xanax overdose yahoo - xanax long term effects
cialis online no prescription overnight cialis daily dose price - buy cialis online usa
buy tramadol tramadol kidney failure - tramadol hydrochloride 50 mg recreational use
buy tramadol tramadol 100mg er - buy tramadol online from usa
http://landvoicelearning.com/#63987 tramadol generic for ultram - tramadol pain killer dosage
buy tramadol online tramadol for dogs cough - order tramadol online cheap
buy tramadol can you buy tramadol in spain - tramadol overdose in a dog
buy tramadol reputable online pharmacy tramadol - tramadol highest dosage
buy tramadol buy ultram tramadol online - buy tramadol 627
http://landvoicelearning.com/#51438 buy 180 tramadol online - tramadol reactions
buy tramadol tramadol withdrawal wikipedia - tramadol to get high
http://buytramadolonlinecool.com/#96430 tramadol 50 mg for ultram - buy tramadol no prescription cheap
buy tramadol can you buy tramadol over counter usa - safest place buy tramadol online
Post a Comment