Hello Everyone!
I didn’t find such topic. So I decide to to set up a topic.
I couldn’t find at script manual the function to convert string to float.
I tried to use the Python function
a = "52525238,27337273,83495772"
float(a) or int(a)
but it didn’t work. Can somebody help me with this?
In URScript, you cannot convert string-based (ASCII) numerics to URScript numbers.
A workaround could be to send the string to an external server, and get the converted numeric back.
E.g. like the XML-RPC Math sample in the samples topic.
If you receive the floats over a socket, the option however would be to use the socket_read_ascii_float()
script code, which is the only case where strings can be converted into floats.
However this require that the string is formatted like "(1.23, 2.34, 3.45)"
Hi Jacob,
Thank You for answer. I receive over a socket such string “52525238,27337273,83495772,”. The socket_read_ascii_float() didn’t work. Worked only socket_read_string()
I will try check the format if it wasn’t wrong, thanks.