Answers for "can a string have numbers"

C++
0

check have string have just numbers

String numbers = "6969696969";
boolean check_n = numbers.matches("[0-9]+"); // true

String notNumber = "0123meowGOGO88l";
boolean check_s = notNumber.matches("[0-9]+"); // false
Posted by: Guest on February-22-2022
0

check if string can be a number and then make a number

if(Number(myNumber) != NaN){
	myNumber = Number(myNumber);
}
Posted by: Guest on January-22-2021

Code answers related to "can a string have numbers"

Browse Popular Code Answers by Language