Trim$ and Lset$ problem
Blitz3D Forums/Blitz3D Beginners Area/Trim$ and Lset$ problem
| ||
A$="ABCD" aa=Len(A$) Text 10,10,aa LSet$(A$,19) bb=Len(A$) Text 10,30,bb Trim$(A$) cc=Len(A$) Text 10,50,cc Can someone please explain why I get the answers: aa=4 bb=4 cc=4 instead of: aa=4 bb=19 cc=4 Many thanks. |
| ||
Because LSet$ and Trim$ (and other related string functions) don't actually change the string you give them. They make a copy of the string and change it. To do what you want, just put "a$=" in front of the two lines.A$="ABCD" aa=Len(A$) Text 10,10,aa a$=LSet$(A$,19) bb=Len(A$) Text 10,30,bb a$=Trim$(A$) cc=Len(A$) Text 10,50,cc |
| ||
Thanks for that. |