Welcome aboard! We are happy you are here and wish you good net-raft!
function isnumber(mystring:string) {
var matches = mystring.match(/^(?=.*[a-zA-Z])(?=.*[0-9])/)
if (matches != null) {
console.log("it is ok!");
} else {
console.log("Please type numeric and alphabetic characters!");
}
}
var str = new isnumber("I am 31 years old!");
<!DOCTYPE html>
<html>
<head>
<script type="text/typescript" src="/typescript/DssZIPNwFf201944183.ts"></script>
<script src="https://rawgit.com/Microsoft/TypeScript/master/lib/typescriptServices.js"></script>
<script src="https://rawgit.com/basarat/typescript-script/master/transpiler.js"></script>
</head>
<body>
</body>
</html>
// /typescript/DssZIPNwFf201944183.ts
var str:String = "I love typescript!"
if (str.match(/^(?=.*[a-zA-Z])(?=.*[0-9])/)) {
document.body.innerHTML = `<div>${"it is ok"}</div>`
}
else
{
document.body.innerHTML = `<div>${"Please type numeric and alphabetic characters"}</div>`
}
var re = /javascript/gi;
var str = "I love javascript";
if (str.search(re) == -1 ) {
console.log("Does not contain javascript" );
} else {
console.log("Contains javascript" );
}
The most helpful TYPESCRIPT solutions
get client ip address using typescriptTYPESCRIPT
Click to see more ...
6.7K
243
detect browser using typescript ?TYPESCRIPT
Click to see more ...
3K
177
detect IE browser using typescript ?TYPESCRIPT
Click to see more ...
2K
172
check if string is number typescriptTYPESCRIPT
Click to see more ...
1.7K
162
check if string contains number and letter using typescriptTYPESCRIPT
Click to see more ...
1.7K
157
typescript src tags in html document TYPESCRIPT
Click to see more ...
1.1K
148
get client latitude and longitude using typescriptTYPESCRIPT
Click to see more ...
1.9K
119
check if string contains a number in typescriptTYPESCRIPT
Click to see more ...
5.7K
111
check if email is valid using typescriptTYPESCRIPT
Click to see more ...
1.1K
97
get client country using typescriptTYPESCRIPT
Click to see more ...
1.1K
81