strings | Sololearn: Learn to code for FREE!

+1

strings

how to convert a alphabetical string in numerical value ?

9/22/2019 8:23:41 AM

Irivichetty Hemanth

3 Answers

New Answer

+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);

0

what language ?

0

It is not very clear what exactly you want. given a string s = "abcde" some may want to convert it to 01234 or 12345. Some may want to convert each letter to their ascii value. So what you want to do?