Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
string and numeric variable questions
#11
Quote:For QB, I usually just say "screwit" and use something like this:

string$ = LTRIM$(RTRIM$(STR$(num)))

I used to do that too, but I found FORMAT$ which does the exact same thing with no string parameter.

ie:

string$ = FORMAT$(num)
Life is like a box of chocolates', hrm, WTF, no it isn't, more like, 'life is like a steaming pile of horse crap.'
Reply
#12
^^^ I wrote that, not ado Wink

I've never heard of FORMAT$ before... if that works fine then use that Wink
Reply
#13
Odd, I just clicked the 'reply with quote' and stripped the rest of the message, I didn't touch the usename.
Life is like a box of chocolates', hrm, WTF, no it isn't, more like, 'life is like a steaming pile of horse crap.'
Reply
#14
*checks the posts*

Oracle, I wrote that ya momo Wink you never even say "screwit" to my knowledge Big Grin

I find that I never have use for string formatting...I guess it's different when you need to represent large numbers by triples though...
I'd knock on wood, but my desk is particle board.
Reply
#15
I used

trim$=str$(carnumber)
trim$=ltrim$(trim$)
mid$(raceentry.finishorder,p)=trim$

print using "###"; val(mid$(raceentry.finshorder,p,3))


coming from programing business basic years back, qbasic is a lot more work. In my opion, Using gosub's and goto's is ok as long as you keep everything structured and easy to follow. Also there is good spagetti and very bad spagetti.
Reply
#16
yup. that code works but i think it's better using 2 lines of code to do the same thing rather than 4

Code:
MID$(raceentry.finishorder, p) = LTRIM$(STR$(carnumber))
PRINT USING "###"; VAL(MID$(raceentry.finshorder, p, 3))
it just combines the three lines


and what you said about structured spagetti.... i think that too (Yummm spagetti)
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#17
Yes, you are right. I'm still trying to get used to all these different commands.
Reply
#18
I did some work myself using Business BAsic for several machines including the BAsic IV and the NCR Tower. What I liked in particular was the I/O, lots more sophisticated than what QB has. The rest of the language is fair.
*****
Reply
#19
Nobody has caught on to what I said yet about FORMAT$

If you use FORMAT$(num) then you don't need to use LTRIM$ since there is no leading space. Why make two function calls when you can make one. Especially when QB is so slooooow about function calls.
Life is like a box of chocolates', hrm, WTF, no it isn't, more like, 'life is like a steaming pile of horse crap.'
Reply
#20
Quote:I did some work myself using Business BAsic for several machines including the BAsic IV and the NCR Tower. What I liked in particular was the I/O, lots more sophisticated than what QB has. The rest of the language is fair.
*****



I miss the direct files...this random stuff sucks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)