Text Parsing Question

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
Pete
Site Admin
Posts: 890
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

Text Parsing Question

Post 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.
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

This should work:

Code: Select all

Parse$ = "QBASIC"

FOR Counter% = 1 to LEN(Parse$)
    PRINT RIGHT$(Parse$, Counter%)
NEXT Counter%
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
PQBC at school

Post 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
Post Reply