js get number from string
thenum = "foo3bar5".match(/\d+/)[0] // "3"
js get number from string
thenum = "foo3bar5".match(/\d+/)[0] // "3"
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)));
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us