You could split the string on ".". That would create an array which you
could then do things with:
var s = 'title.string1-color.string2-size.string3';
Var sArr = s.split('.');
Alert(sArr);
Returns "title,string1-color,string2-size,string3"
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of cfdvlpr
Sent: Friday, August 10, 2007 11:53 AM
To: jQuery (English)
Subject: [jQuery] Using jQuery to parse a string
I want to parse a string of the following form:
var s = title.string1-color.string2-size.string3
How do I create a struct with the three strings?
h = {};
h['title'] = s.match()
h['color'] = s.match()
h['size'] = s.match()
Can you help me do the rest? Would I just want to use the .match javascript
function and some regex, or is there a neater way to parse strings?