String splitting

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
hezoe
Coder
Posts: 20
Joined: Sat Jun 04, 2005 6:29 am
Location: Tasmania, Australia
Contact:

String splitting

Post by hezoe »

Hi. What is the fucntion used to split a string into two at a certain point (i.e at .)?
Bill Sindel

string Splitting

Post by Bill Sindel »

The three string commands that come to mind are;

LEFT$(n)

RIGHT$(n)

MID$(l,n)
Z!re
Veteran
Posts: 887
Joined: Wed Aug 04, 2004 11:15 am

Post by Z!re »

INSTR(s$, w$)

Example:

Code: Select all

s$ = "Hello World!"
l$ = LEFT$(s$, INSTR(s$, " ")-1)
r$ = RIGHT$(s$, LEN(s$)-LEN(l$))

print " '"+l$+"' "
print " '"+r$+"' "
I have left this dump.
Post Reply