dear all..
i want after i have been type 123A0001-123A0100
the result is 100
.
Or if 123A0123-123A0200
the result is 78
.
how do i do that?please help.
thanks before.
dear all..
i want after i have been type 123A0001-123A0100
the result is 100
.
Or if 123A0123-123A0200
the result is 78
.
how do i do that?please help.
thanks before.
var str = 'A0001-A0100',
match = str.match(/\d+/g);
if (match) {
alert(+match[1] - +match[0]);
}
+
(unary plus) will cast the string to a number (does the same as Number(...)
).