Tuesday, 15 September 2015

How to check that (sub)string is a number in javascript? -



How to check that (sub)string is a number in javascript? -

there lots of answers question on none javascript...

how can check if first 16 characters of sting 20130203003002od number? meaning substring doesn't contains letters nor other characters digits?

you test string against regular look so:

var info = "20130203003002od"; var matched = data.match("[0-9]{16}.*");

if matched null, means first 16 characters not number.

javascript

No comments:

Post a Comment