String str1 = "1234";
integer j = str1.charAt(1);
print(j);
This returns 50 as a result but I want 2 as an answer.
String str1 = "1234";
integer j = str1.charAt(1);
print(j);
This returns 50 as a result but I want 2 as an answer.
String str1 = "1234";
integer j = str1.charAt(1) - 48 ;
print(j);
// because ASCII value of 0 is 48 and ASCII value of 2 is 50
//so 50 - 48 = 2