len and mid$ by MikeS5th Jun 2004 14:03
|
---|
Summary Learn how to utilize characters in your text with the len and mid$ command. Description Learn how to utilize characters in your text with the len and mid$ command. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com sync on : sync rate 60 `Set up our refresh rate. string$="-1.31" `This is the string we'll be testing for. do `Start our loop set cursor 0,0 `Set our cursor `Before we use the mid$ string, we'll want to find out how long our string is. `We do this by using the 'len' command, and then inputting our string. print "There are ";len(string$); " characters in this string." `We now will use the 'mid$' command. This command can be very useful for us. `In this tutorial, you'll see how the characters are picked up. `Basically, you input the string you'd like to test for and you put in the character `you'd like to find. This can be very helpful for picking out test. print "first character ";mid$(string$,1) print "second ";mid$(string$,2) print "third ";mid$(string$,3) print "fourth ";mid$(string$,4) print "fifth ";mid$(string$,5) `Now we just print our string so you can see how it all fits into place. print "This is our full string ";string$ sync `refresh the screen loop `Loop our program |