Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

loop and save letters in a string java

StringBuilder phone = new StringBuilder();
for (int i = 0; i < number.length(); i++){
    if (Character.isLetter(number.charAt(i))){
        phone.append(getNumber(Character.toUpperCase(number.charAt(i))));
    }else{
        phone.append(number.charAt(i));
    }
}

System.out.println("Your number is " + phone.toString());
 
PREVIOUS NEXT
Tagged: #loop #save #letters #string #java
ADD COMMENT
Topic
Name
2+7 =