TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: MICHAEL QUINLAN
from: JAMES GOLDBLOOM
date: 1996-05-27 09:06:00
subject: Re: DAT files

 MQ>  var$ is now equal to "12345     ".  If you do this:
 MQ>
 MQ>     var$ = rtrim$(var$)
 MQ>
 MQ>  var$ is still equal to "12345     "
You obviously did not test your theory.  I just did, and it stripped
the variable beautifully of the spaces.  No need to declare a second
variable with slows down the process, uses memory, etc., etc.  Matter
of fact, it's sloppy programming.
Not only that, the question of the user WAS answered because the
padding was null bytes, not spaces, so the command which WILL work:
            ^^^^^^^^^^^
var$=rtrim$(var$,any chr$(0)+" ")
(and there are other ways to do the above, see the replies of others, mine
is but merely one way)
I am using PB3.2, I compiled and ran the following *TESTED* (ahem!) code:
-------------------------TRIMTEST.BAS---------------------------
var$="1234    "
var$=rtrim$(var$)
print var$"*"
print len(var$)
----------------------------------------------------------------
SCREEN output result:
1234*
 4
(I used the old aid, add a characters to the end for a visual reference to
 see where the string ends since usually ya can't see spaces if the same
 background color; the LEN display verifies it works FER SHUUUUUR.)
Sorry, Michael.  No offense taken I hope, but you're quite wrong on this
stuff, all around.  I had to clarify something so blatantly off, so
as not to confuse new users to PB about bad programming habits.  Surely
you will see other replies from other users, stay tuned unfortunately.
:-( 
-James
--- QuickBBS 2.80 (Zeta-1.9A)
---------------
* Origin: [Team QuickBBS] [Team OmegaSoft] [PB Fanatic!] (FIDONET 1:109/611)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.