Computer Science Canada

Grr... stupid put command things

Author:  Blade [ Wed Mar 19, 2003 7:37 pm ]
Post subject:  Grr... stupid put command things

for some reason i cant get my strings to move over, when i want them to, but the integers will ! Sad i dont know of any other way to do this though...
as an example

code:

put "crap":20


what i'm trying to do is read 5 names, from a file, 5 marks, and 5 addresses and line them up in a table

as an example

John 123 Fake St. 86
Bill 45 Valley Ave 34

and so on...

but for some reason, i cant get strings to move over, and all that's readable from files are strings...

Author:  Tony [ Wed Mar 19, 2003 7:43 pm ]
Post subject: 

i donno... works for me. It adds extra spaces AFTER the string though.

code:

put "":round(maxcol/2 - length("tony")/2), "tony"


that would put "tony" right in the center of the screen.

Author:  Asok [ Wed Mar 19, 2003 7:48 pm ]
Post subject: 

You need to calculate the correct variable for :x x is not always equal to 20 it is equal to 20 minus the characters before so everything starts on the same line.

Author:  Blade [ Wed Mar 19, 2003 7:56 pm ]
Post subject: 

well i think it still should move over, its not doing anything

edit:
haha i figured it out

Author:  Vicous [ Thu Mar 20, 2003 11:11 am ]
Post subject: 

strings and numbers are aligned different, strings will put the extra spaces to the right, numbers put extra spaces to the right eg.

put "Hi":20,"bye"
gives you 18 spaces (20-# of letters)

Hi__________________bye

var number:int:=10
put number,"Bye"

gives you 18 spaces, the number 10 followed by the word bye

__________________10Bye

I hope this explains it
P.S. 1 underscore (_) equals 1 space, the forum edits out extra spaces

Author:  Blade [ Thu Mar 20, 2003 11:32 am ]
Post subject: 

yea thanks, i was playin around with it and i figured it out... numbers have extra spaces before them, whereas strings have extra spaces after them Very Happy


: