Page 1 of 1

question about concatenation

Posted: Fri Sep 03, 2004 2:07 pm
by Bojangles
I have two values and 2 string$ variables I need to concatenate. It doesn't like it. I have year day line$ and run$ and I need then as 1 value or string. I tried let lot$ = year + day + line$ + run$ but no dice. Any way to join these items as 1?

Uhhh

Posted: Fri Sep 03, 2004 3:25 pm
by {Nathan}
thats kinda confusing, but i might know wut u wanna do. if some of thes little things you are tying to add are integers, then just use MK... uhh... i dunno wut the exact thing is, but it starts with mk. you con convert integers, singles, doubles to string. hope that helps!!! :? :? :?

Posted: Fri Sep 03, 2004 3:29 pm
by Bojangles
2 are values 2 are string but I want to end up with 1 printable string. Here's the example. year = 4 day = 242 line$ = 26 run$ = 1 Year and day are calculated, line and run are entered. I need 1 printable string out of that , that is 4242261.

i...can...hELP

Posted: Sat Sep 04, 2004 7:24 am
by {Nathan}
just do it like this

PRINT Varible1, Varible2

ect
easy, eh?

Posted: Sat Sep 04, 2004 9:15 am
by Anonymous
Er... no.

The way Nathan1993 suggested will have 4 or more spaces between the variables.

Here's the way to do it:

Code: Select all

lot$ = LTRIM$(STR$(year)) + LTRIM$(STR$(day)) + line$ + run$
PRINT lot$
STR$ converts a number variable (integer, long, single, double) to a string. If the number is positive, it will have one space in front. That's why I use LTRIM$ as well. It removes spaces at the front of a string.

Hope it helped... again ;)


And Nathan1993:
Nathan1993 wrote:then just use MK... uhh... i dunno wut the exact thing is, but it starts with mk.
You must mean MKI$, MKL$, MKS$ and MKD$. But these are not used for converting numbers to numerical strings. They are for converting numbers to strings bitwise. So if you have a number 666 and you make a string out of it using MKI$, you'll get CHR$(&H9A) + CHR$(02).

So, use STR$. Then the number 666 will just become " 666".

;)

Posted: Tue Sep 07, 2004 9:59 am
by Bojangles
Thanks again. That's why I come to the pros. I was offline due to the Hurricane. We took quite a hit and doubt we could survive another. If Ivan comes, I may not be back at all.

Posted: Wed Sep 08, 2004 11:00 am
by Anonymous
No problem :)

Hurricanes are bad. I hope you'll survive any hurricane that passes by!