check whether string has number code example
Example 1: check if string contains numbers
str.matches(".*\\d.*");
Example 2: check if string can be a number and then make a number
if(Number(myNumber) != NaN){
myNumber = Number(myNumber);
}
str.matches(".*\\d.*");
if(Number(myNumber) != NaN){
myNumber = Number(myNumber);
}