Reputation: 21971
I am trying to translate some C# code into java and would like to know what is the java equivalent of System.Convert.ToInt32(char)
:
Converts the value of the specified Unicode character to the equivalent 32-bit signed integer.
Convert.ToInt32(letter);
Upvotes: 0
Views: 9207
Reputation: 6542
"Convert.ToInt32(someChar)" does exactly what "(int)someChar" does. Since "(int)someChar" is available in Java, why not use that?
When testing the various options, use '5' as a test - some options will convert this simply to the integer 5, but you will want the integer 53 to match the original C# behavior of Convert.ToInt32.
Upvotes: 5