strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

strings

how to convert a alphabetical string in numerical value ?

22nd Sep 2019, 8:23 AM
Irivichetty Hemanth
Irivichetty Hemanth - avatar
2 Answers
+ 3
You could do somthing like this, it will only work with lower case letters, somthing you can improve on if it helps. char alpha = 'a'; int position = alpha-96; System.out.print("letter "+alpha+" = "+position);
22nd Sep 2019, 11:18 AM
D_Stark
D_Stark - avatar
0
what language ?
22nd Sep 2019, 8:29 AM
Peter Parkers
Peter Parkers - avatar