login

printf.gsf

Top / GrADS / script / printf.gsf

Japanese / English

Name

printf() - C-printf-style formatting.

Synopsis

ret = printf( format [, arg1, ..., arg10] )

Description

Support only integer number. Use %f of math_format if you want to use it.

Options and Return values

format
%d, %5d, %07d, any strings, etc.
ret
Formatted string.

Examples

(1) Show "15" in a various formatting method.

  • test.gs
    rc = gsfallow( 'on' )
    v = 15
    say printf( '%d', v )
    say printf( '%5d', v )
    say printf( '%05d', v )
    
  • console
    ga-> test
    15
       15
    00015
    

Script source code