Re: Using two sprinti calls in one string

From: Kyle Griffin <ksgriffin2_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 06 2014 - 09:10:26 MST

Hi Ciara,

If that is the exact code you have in your script, you have two problems.
First, you should also always use i in the format string of sprinti,
regardless of the variable you are using. You should also add a + after
your first sprinti call to ensure proper concatenation of the strings
(although it seems to have worked partially without that +, which is
interesting). The end of your string should look more like this:

sprinti("%0.4i",i) + " / " + sprinti("%0.4i",j)

See examples 2 and 3 on the sprinti page for more guidance.

http://www.ncl.ucar.edu/Document/Functions/Built-in/sprinti.shtml

Kyle

----------------------------------------
Kyle S. Griffin
Department of Atmospheric and Oceanic Sciences
University of Wisconsin - Madison
Room 1421
1225 W Dayton St, Madison, WI 53706
Email: ksgriffin2@wisc.edu

On Thu, Mar 6, 2014 at 10:01 AM, Ciara O'Hara <cohara1985@hotmail.com>wrote:

> Hi everyone,
>
> I want to add a title to my graph that says "Average Winter Temperature
> i/j" where i and j are years that the script is running through.
>
> The script I have is:
>
> resources@tiMainString="Average Winter Temperature " + sprinti("%0.4i",i)
> " / " + sprinti("%0.4j",j)
>
> but the title I am getting is: Average Winter Temperature i /
>
> The second year does not appear.
>
> Can anyone tell me how I can use two sprinti calls in one string?
>
> Regards,
> Ciara
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 6 09:11:00 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 14 2014 - 15:08:52 MDT