Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
ElliotR
21
Years of Service
User Offline
Joined: 2nd Nov 2002
Location: United Kingdom
Posted: 3rd Nov 2002 13:45
how do i take string1$ "data1, data2" and turn it into;
string1a$ "data1"
string1b$ "data2"

spliting at the ", " but leaving it out?

data 1 can change length so can data 2

i have looked for an answer in the forums but not come across one please help

for example the user types this in my version of dos

copy a:\, c:\

it can recognise the copy part and remove it
but how do i regonise the comma, and the length of the data between it and the beggining?
Flashing Blade
21
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 3rd Nov 2002 15:08
hiya elliotR

I not very experienced in dbp yet but i done a similiar thing in visual basic. This is how i would code it:

commapos=0
string1a$=""
string1b$=""

input string1$

for count=1 to len(string1$)
if mid$(string1$,count)="," then commapos=count:exit
next count

if commapos<>0
for count=1 to (commapos-1)
string1a$=string1a$+mid$(string1$,count)
next count
for count=(commapos+1) to len(string1$)
string1b$=string1b$+mid$(string1$,count)
next count
endif

do
set cursor 20,50
print "a";"-";string1a$;" ";"b";"-";string1b$
loop

hope thats what u want
ElliotR
21
Years of Service
User Offline
Joined: 2nd Nov 2002
Location: United Kingdom
Posted: 3rd Nov 2002 18:11
thx, flashing blade, i can now alter the code to fit around what i ned it to do,

ur name shall appear in the credits!!!!

p.s ill send u a copy when its done!

Login to post a reply

Server time is: 2024-02-24 23:53:02
Your offset time is: 2024-02-24 23:53:02