I’m experiencing a weird problem with the parseInt function. This is my code:
var value : String = initValue();
var value_index : int = value.Length-1;
Debug.Log("value[value_index]:"+value[value_index]);
var last : int = parseInt(value[value_index]);
Debug.Log("Results: "+last.ToString());
‘value’ is a string which has a digit as last character. When I am trying to parse it so as to convert it I get the char’s ascii representation returned, instead. This is the output from executing the above code:
value[value_index]:2
Results: 50
I’ve tried with the last character to be “1” and I get 49. This makes me think that it returns the ascii code. But this isn’t what the documentation says.