removing parts of a string

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
qbasicfreak
Veteran
Posts: 90
Joined: Wed Oct 22, 2008 3:27 pm
Location: canada

removing parts of a string

Post by qbasicfreak »

How do you remove choice parts of a string.

For my chat program the program has to search each individual line for a specific word.
If the line is the one it wants it then has to be able to remove the letters before the comma and the comma itself.

example:
*the user entered the word hello
*the program searches through the text file and finds the right phrase
hello,how are you?
*it has to remove the hello and the comma.

thanks
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Why do you need to remove text from the file?

You would have to make a temp file of the original and edit the line where hello, is found. Then copy the updated file back to the original.

INSTR and MID$ would still work for you in the program.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply