Answers for "check if a string is a number in typescript"

2

typescript check if string is number

let numberToCheck: string = "40";

if(!isNaN(Number(numberToCheck))) {
	console.log("string is a number")
}
else {
	console.log("string is NOT a number")
}
Posted by: Guest on May-20-2021
1

check if string include numbers in typescript

var isInclude = myString.match(/\d+/g);
//isInclude is RegExpMatchArray type and contain an array of letters are include in myString
Posted by: Guest on November-08-2021

Code answers related to "check if a string is a number in typescript"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language