Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java get number out of string

for(int i=0; i<yourString.length();i++) {
  if(Character.isDigit(yourString.charAt(i))) {
    // Do something with the number
    // For example convert it to int:
    int yourNumber = Integer.parseInt(String.valueOf(yourString.charAt(i)));
  }
}
 
PREVIOUS NEXT
Tagged: #java #number #string
ADD COMMENT
Topic
Name
4+4 =