Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
132
rated 0 times [  136] [ 4]  / answers: 1 / hits: 49214  / 12 Years ago, tue, june 19, 2012, 12:00:00
mystring = 9862 ....... -pack size 1 - SST Unspun Label (Roll) CAT#: 9862


I want to get the first 4 numbers in this string 9862. How do I get the first sequence of numbers in this string. And store it in anothoer variable?



Javascript doesn't seem to be recognizing this variable. I don't know why.
if I do:



alert(mystring); //I don't get an alert pop up nor does it show any errors.


Could there something be wrong with the text I'm trying to store in 'mystring' variable?


More From » string

 Answers
102
mystring = 9862 ....... -pack size 1 - SST Unspun Label (Roll) CAT#: 9862;

mystring = mystring.substring(0, 4);

alert(mystring.trim());

[#84816] Monday, June 18, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tomas

Total Points: 165
Total Questions: 111
Total Answers: 103

Location: Maldives
Member since Tue, Dec 21, 2021
2 Years ago
tomas questions
Thu, Jan 27, 22, 00:00, 2 Years ago
Mon, May 10, 21, 00:00, 3 Years ago
Tue, Jan 5, 21, 00:00, 3 Years ago
;