PDA

View Full Version : Capture values of a string


bluez
10-09-2002, 10:11 AM
i have a variable.. it consists of a few letters as follows:

124,age - 1af9af

how can i get the three letters after the comma, age??
thanks

glenngv
10-09-2002, 10:24 AM
str = "124,age - 1af9af";
commapos = str.indexOf(",");
if (commapos!=-1){
str = str.substr(commapos+1,3);
}
alert(str)

bluez
10-09-2002, 10:39 AM
it works.. thanks alot glenngv! :thumbsup: