Re: formatted output

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 28 2012 - 17:46:54 MDT

Here is one way to left justify, with a string function. It is not as
compact as having a dedicated format code. The value of "length"
should be the same as in the corresponding %s width, if you use
str_print.

ncl 0> x=(/"abc","12345678","vwxyz"/)
ncl 1> length=8
ncl 2> print ("["+str_insert(x,"",length)+"]")
(0) [abc ]
(1) [12345678]
(2) [vwxyz ]

This was inspired by example 5 on the str_insert function page, which
is perhaps a better explanation of how this works.

--Dave

On Thu, Jun 28, 2012 at 12:55 PM, ousmane ndiaye <ondiaye70@gmail.com> wrote:
> Hi,
> thanks for the  str_print it solved my problem just one more thing is there
> a way to have the string/character (%20s) "align left" instead of right as
> it is.
> Ousmane
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jun 28 17:47:04 2012

This archive was generated by hypermail 2.1.8 : Fri Jun 29 2012 - 15:46:14 MDT