Dear GAP Forum,

concerning the question by R.N. Tsai

> Is there a way to do a formatted print in GAP?
> Something equivalent to this for example :  %6d or %-6d  to print an 
> alignedfixed width 6 bit integer....(these are c examples but are used in 
> other languages too).

I would suggest the 2-argument version of 'String',
which creates left or right aligned strings,
depending on
and fills up with whitespace.

Here is an example.

    gap> for i in [ 1 .. 6 ] do Print( String( 10^i, 6 ), "\n" ); od;
        10
       100
      1000
     10000
    100000
    1000000
    gap> for i in [ 1 .. 6 ] do Print( String( 10^i, -6 ), ".\n" ); od;
    10    .
    100   .
    1000  .
    10000 .
    100000.
    1000000.

All the best,
Thomas


_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to