PDA

View Full Version : Converting strings to number


gammeltoft
11-05-2002, 12:13 AM
Looking for a way to convert a string to a number in a Onespace macro.
By using some command like string-to-number in ME10.

I have a comma-separated file containing:
an x-coordinate
an y-coordinate
and finally an angle (rad).
Like this:
0.12345,0.67685,0.0345
0.12456,0.68745,0.0445
0.12567,0.69984,0.0545
and so on....

I read in the values opening the file and thereafter
uses (read-line file-stream nil 'eof).

All of the values are read into variables but as strings.

Does anyone have some ideas to solve this problem?

Is it possible to read in the values directely in numeric format or
is it possible to convert them later on like in ME10?

Kind Regards
Henrik Gammeltoft

Markus
11-05-2002, 08:13 AM
Hello Henrik,

all you need to do is to use READ instead of READ-LINE. That works just fine because a line like 0,0,0 is a Designer data type: gpnt3d. Please see the Integration Kit documentation titled "Arithmetical and Vector Utilities" for more information.
That way you don't need to convert a string to a number.

Hope this helps.

Markus