RE: text to number 2

new topic     » topic index » view thread      » older message » newer message

> ok,  I have reviewed the value library function for converting a
> sequence to a number,  but how do you get a sequence like
> {"-","1","2",".","2"}  to be {"-12.2"} as the function needs it to be?
> Or am I missing something obvious?  I need to make a file filter and I
> need to be able to convert back and forth regularly from string to
> numeric.

First, {"-","1","2",".","2"} is not a string; it's a series (or array) of
strings, the first being "-" and the last being "2".

"-12.2" is a string.

If you really need to get {"-","1","2",".","2"} as a value, you'll have to
do this:

for t=1 to length(myArray) do -- for each value in the array
	myTxt &= myArray[t] -- make it part of the new string
end for

myNum = sprintf("%d",{myTxt}) -- get the value of the new string using
sprintf()

I think that should work.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu