Use regex to check the substring. Set your regex value (var testo =
/^[-+]?[0-9]+$/;) and use the match method or similar to test the result (
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match
)
Best regards,
*Jason Bengtson*
*http://www.jasonbengtson
There's a number of solutions:
https://goo.gl/KcSFTq
Personally. I'd use the jQuery function.
I'm much more interested in what "CLASSIFICATION: UNCLASSIFIED" means, is
that appended and prepended to every .mil email?
On Thu, Jan 18, 2018 at 8:51 AM, Mark Pernotto
wrote:
> Without any more inf
January 18, 2018 10:47
To: CODE4LIB@LISTS.CLIR.ORG
Subject: [CODE4LIB] javascript help (UNCLASSIFIED)
CLASSIFICATION: UNCLASSIFIED
Anybody can help me with such JavaScript code that can chop the ending portion
of the string - last 5 characters - verifying if it is all numbers (zip code)?
Thanks.
Without any more information, you could do something along these lines:
var string = '9-0123';
var newstring = string.slice(0,-5);
But that won't take into account if the first 5 numbers are, in fact,
numeric. Should the numeric check occur prior to the string slicing?
Mark
On Thu, Jan 1
CLASSIFICATION: UNCLASSIFIED
Anybody can help me with such JavaScript code that can chop the ending portion
of the string - last 5 characters - verifying if it is all numbers (zip code)?
Thanks.
Kelly Zhu
CLASSIFICATION: UNCLASSIFIED