Page 1 of 1

Truncating Strings

Posted: Tue Jul 30, 2002 2:44 am
by Guest
What is the command to resize a string?  Example:

I want to resize "electric guitar" to just "electric"

(AKA removing the last eight characters)

Are there any commands to do this?

Re: Truncating Strings

Posted: Tue Jul 30, 2002 12:01 pm
by madmartin55
Try:

a$=LEFT$(a$, 8 )

:)

Re: Truncating Strings

Posted: Thu Aug 29, 2002 12:52 am
by Guest
If you want to seperate it based on spaces try:

L=LEN(A$)
FOR A=1 TO L
B$=MID$(L,A$,1)
IF B$=" " THEN GOTO 10
NEXT

10 C$=LEFT$(A$,L)

That's from memory, so you probably should check the help file for MID$ cuz I don't remember which (L A$ or 1) goes where, but L is the position, A$ is the string, and 1 is the length.