[Gambas-user] Format Text

Benoît Minisini gambas at ...1...
Fri Apr 24 10:55:34 CEST 2009


> Hi,
>
> Can you quote the thing you've written? Maybe you missed something or
> so... Normally it should work with both len() or string.len()
>
> Ok, then you said you will only give strings to another program, so the
> font shouldn't be important. In Basic, the only way of doing what you
> want will be using Print with a comma:
>
> print "22.55", 'the comma adds a tab character chr$(9)
>
> Then I remember (was it PowerBasic?) a "USING" thing where one could do
> such things with a mask of "###" or so. Long time ago, very, very long
> time ;-) Never used that stuff then.
>
> But as you need right-aligned tabs... you will need to spend a little
> time developing an algorithm that assembles your lines.
>
> You mentioned other languages that offer easier ways. Can you give me an
> example? The easiest way I can think of would be some function where you
> define the line length and the tabs and then you add the strings to be
> inserted. If this function just replaces a line of spaces with the
> inserted strings, it wouldn't be too complicated.
>
> Rolf
>

In Gambas 3, you can do that:

sBuffer = Space$(80)
Mid$(sBuffer, 1) = FirstColumn
Mid$(sBuffer, 15) = SecondColumn
Mid$(sBuffer, 28) = ThirdColumn
...
Print sBuffer

Regards,

-- 
Benoît




More information about the User mailing list