Page 1 of 1

Text Parsing Question

Posted: Tue Nov 29, 2005 12:06 pm
by Pete
I'm busy. Have at it, guys!
email: ivan5815@yahoo.com

name: Ivan Rijadi

Comments: Master Pete,
I'm a super newbie in QBASIC. I recently read the tutorial in the Net, but I can't develop the program any further.The program output was like this:
C
IC
SIC
ASIC
BASIC
QBASIC

Can you tell me how to do it? And please make it simple so I won't get confused. Thanks for your time.

Posted: Tue Nov 29, 2005 12:44 pm
by MystikShadows
This should work:

Code: Select all

Parse$ = "QBASIC"

FOR Counter% = 1 to LEN(Parse$)
    PRINT RIGHT$(Parse$, Counter%)
NEXT Counter%

Posted: Tue Nov 29, 2005 2:37 pm
by PQBC at school
I'll insert comments to make it easier, hence:
QBASIC Newbie wrote: Can you tell me how to do it? And please make it simple so I won't get confused. Thanks for your time.

Code: Select all

Parse$ = "QBASIC"   'What the original word is to parse

FOR Counter% = 1 to LEN(Parse$)    'Starts a loop which goes until the end of the word is reached
    PRINT RIGHT$(Parse$, Counter%)   'Output how many letters are at the end, which has been counted
NEXT Counter   'Go back to the start of the loop