Ryan,
I'd suggest a work-around like this:
chars = tochar(your_original_strs)
(generate a char-array from string)
cap_strs = str_capital(your_original_strs)
(now cap_strs and your_original_strs are both capitalized)
...
low_strs = tostring(chars)
(low_strs should be your original string).
For example, we can do:
;-------------
strs = "hello world!"
cap_strs = str_capital(strs)
chars = tochar(strs)
ori_strs = tostring(chars)
print(cap_strs)
print(strs)
print(ori_strs)
;-------------------------
Hope this help.
Wei
huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924
On Aug 27, 2012, at 11:51 AM, Ryan Pavlick wrote:
> My workaround actually didn't work. I should have tested it first.
>
> It not only affects the input variable but also copies of the input
> variable. You can see what I mean in the script below.
>
> Do you have a suggestion other than the obvious one of reverting back to 6.0?
>
>
> Copyright (C) 1995-2012 - All Rights Reserved
> University Corporation for Atmospheric Research
> NCAR Command Language Version 6.1.0-beta
> The use of this software is governed by a License Agreement.
> See http://www.ncl.ucar.edu/ for more details.
> + strs = "hello world!"
> + strs_copy= strs
> + strs_copy_copy = strs_copy
> + strs_not_a_copy = "hello world!"
> + other_var_name = "hello world!"
> + other_string = "goodnight moon!"
> + other_string_plus_strs = other_string + " " +strs
> + strs_plus_other_string = strs + " " +other_string
> + strs_plus = "hello world!" + " "
> +
> + strs_capital = str_capital(strs)
> +
> + print(strs_capital)
>
>
> Variable: strs_capital
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) Hello World!
> + print(strs)
>
>
> Variable: strs
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) Hello World!
> + print(strs_copy)
>
>
> Variable: strs_copy
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) Hello World!
> + print(strs_copy_copy)
>
>
> Variable: strs_copy_copy
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) Hello World!
> + print(strs_not_a_copy)
>
>
> Variable: strs_not_a_copy
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) Hello World!
> + print(other_var_name)
>
>
> Variable: other_var_name
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) Hello World!
> + print(other_string)
>
>
> Variable: other_string
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) goodnight moon!
> + print(other_string_plus_strs)
>
>
> Variable: other_string_plus_strs
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) goodnight moon! hello world!
> + print(strs_plus_other_string)
>
>
> Variable: strs_plus_other_string
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) hello world! goodnight moon!
> + print(strs_plus)
>
>
> Variable: strs_plus
> Type: string
> Total Size: 8 bytes
> 1 values
> Number of Dimensions: 1
> Dimensions and sizes: [1]
> Coordinates:
> (0) hello world!
> _______________________________________________
> 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 Tue Aug 28 10:12:28 2012
This archive was generated by hypermail 2.1.8 : Tue Sep 11 2012 - 15:30:42 MDT