Java

Char to Integer

yougeun 2022. 11. 6. 19:38
728x90

Char to Integer

String str = "123456789";
int answer = 0;
for(int i=0; i<str.length();i++){
    answer+= str.charAt(i)-'0';
}
728x90