Re: stringtointeger - reformatting?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 13 Dec 2006 17:29:14 -0700 (MST)

Hi Micah,

It shouldn't matter whether your strings have spaces in them. If you
use "stringtointeger" to convert it to an integer, the string " 5 "
should give you an integer:

ncl 0> s = " 5 "
ncl 1> i = stringtointeger(s)
ncl 2> print(i)
Variable: i
Type: integer
Total Size: 4 bytes
             1 values
Number of Dimensions: 1
Dimensions and sizes: [1]
(0) 5
ncl 3>

This integer, then, should be usable in any function that expects an

I suspect that the error message you're getting is from something
else. Perhaps if you sent me a few lines of code around where the
error message is occurring, I will be able to tell what the problem

One possibility is that for whatever function you are calling, the
variable you have on the left hand side already exists, and is not the
same type as what the function is trying to return.


On Wed, 13 Dec 2006, Micah Sklut wrote:

> Hello,
> I am running into a problem I believe that has to do with how I"m using the
> stringtointeger conversion.
> I'm reading in directional txt... example: "320" , "5 ","180","35 "
> I have a small function which changes the integers to directional text..
> example: "NW", "ESE", etc...
> the data is originally in string format, so I use the stringtointeger
> function to change to integer. I have no problems
> with this when the text contains 3 values ("320"), but if the text is " 5 "
> or "35 " the stringtointeger function works without error, but
> i get an error when I take the integer into the function.
> I get the following error:
> fatal: Illegal right-hand-side type for assignment
> Does this make sense that the error is due to taking a 3 character string
> with blanks into an integer?
> If so, is there a way to format the string, to remove any blank
> characters?
> Thank you.
> Micah Sklut
ncl-talk mailing list
Received on Wed Dec 13 2006 - 17:29:14 MST

This archive was generated by hypermail 2.2.0 : Wed Dec 13 2006 - 18:35:27 MST