Thread: String to Int
View Single Post
# 1 29-03-2006 , 02:57 AM
mayakid14's Avatar
Registered User
Join Date: Nov 2004
Location: Florida
Posts: 105

String to Int

Does anyone know if there is a way to convert a string to an int or a float.
Example:

string $mystring = "15";
int $myint = ($mystring - 1);
print $myint;

Maya doesn't execute this script because $mystring doesn't really have a int value. In BASIC I think this concept would be written as:
Dim mystring As string = "15"
Dim myint As integer = (val(mystring) - 1)
MsgBox(myint)
The VAL function works in BASIC but it won't work in MEL. Of course it doesn't seem like MEL hasa VAL function but is there an alternative?


I hope you didn't waste your time reading this line.