Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problems with .split

Status
Not open for further replies.

simeyg

Programmer
Joined
Nov 20, 2002
Messages
2
Location
GB
hi all,
i am having a problem with the .split function. i want to split a sting twice so i can get my vars but the second time i split the string i get a comma inplace of the the specified spliter e.g.
Code:
myString = "c_type=Any&c_model=Any&c_min=0&c_max=1000000
"
splitString = myString.split("&");
tempstring = splitString[0]; //the first item in the array
tempstring2 = tempstring.split('=');
but when i do the second split it returns this string
"c_type,Any" instead of just "Any"

this has been driving me mad for 2 hours

Any help would be Greatfully appreciated

Simon

 
It is showing you "c_type,Any" because that is a text representation of the string array. If you just want the second tokenized string you need to change tempstring2 to :

tempstring2 = tempstring.split('=')[1];

Hope that helps,

Kev
[afro2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top