Answers for "How to check if String contains other than numbers"

5

check if string contains numbers

str.matches(".*\\d.*");
Posted by: Guest on November-01-2020
0

check if string contains anything other than numbers

String.prototype.isNumber = function(){return /^\d+$/.test(this);}
console.log("123123".isNumber()); // outputs true
console.log("+12".isNumber()); // outputs false
Posted by: Guest on March-11-2021

Code answers related to "How to check if String contains other than numbers"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language