If I have a string like String myString = "12345" and I want to return the value at index [0]. How do I do this? I've tried for example int foo = myString.charAt(0) and get a weird value like 49?
            Asked
            
        
        
            Active
            
        
            Viewed 9,285 times
        
    0
            
            
         
    
    
        Alec
        
- 5
- 2
- 3
- 
                    dupe of [Java: parse int value from a char](http://stackoverflow.com/a/4968343/1248974) – chickity china chinese chicken Nov 19 '16 at 01:23
1 Answers
3
            Use Character.getNumericValue():
String myString = "12345";
int foo = Character.getNumericValue(myString.charAt(0)); 
 
    
    
        Robby Cornelissen
        
- 91,784
- 22
- 134
- 156