cyprus106
Programmer
- Apr 30, 2001
- 654
I've got to split a string 2 times, one inside of the next to find and change a certain variable. When I change that variable, I want to put it back in the original string but my methods seem to fail repeatedly.
What I do is split the string by ':'s first, then by ','s inside that. then i tried to step back out the way i came in by putting the second split inside the first and the first inside the original string again. Didn't work
Here's my code. Hope someone asphigher than me knows what to do. thanks!
inItems = Split(Request.Cookies("SavedItems"
, ":"
For x = 0 to UBound(inItems) - 1
itemProps = Split(inItems(x), ","
if itemProps(1) = request("item_name"
then
itemProps(0) = int(itemProps(0)) + 1
inItems(x) = ""
For j = 0 to UBound(itemProps) - 1
inItems(x) = inItems(x) + itemProps(j)
next
Dim strItems
For i = 0 to UBound(inItems) - 1
strItems = strItems + inItems(i)
strItems = strItems & ":"
next
response.Cookies("SavedItems"
= strItems
end if
Next
Cyprus
What I do is split the string by ':'s first, then by ','s inside that. then i tried to step back out the way i came in by putting the second split inside the first and the first inside the original string again. Didn't work
Here's my code. Hope someone asphigher than me knows what to do. thanks!
inItems = Split(Request.Cookies("SavedItems"


For x = 0 to UBound(inItems) - 1
itemProps = Split(inItems(x), ","

if itemProps(1) = request("item_name"

itemProps(0) = int(itemProps(0)) + 1
inItems(x) = ""
For j = 0 to UBound(itemProps) - 1
inItems(x) = inItems(x) + itemProps(j)
next
Dim strItems
For i = 0 to UBound(inItems) - 1
strItems = strItems + inItems(i)
strItems = strItems & ":"
next
response.Cookies("SavedItems"

end if
Next
Cyprus