strings | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

strings

how to convert a alphabetical string in numerical value ?

22nd Sep 2019, 8:23 AM
Irivichetty Hemanth
Irivichetty Hemanth - avatar
2 Réponses
+ 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