gsr
07/30/2022, 1:28 AMzackster
07/30/2022, 8:02 AMAdam Cameron
gsr
07/30/2022, 3:30 PMpublic any function StructToQueryString(struct) {
var qstr = "";
var delim1 = "=";
var delim2 = "&";
switch (ArrayLen(Arguments)) {
case "3":
delim2 = Arguments[3];
case "2":
delim1 = Arguments[2];
}
for (key in struct) {
if (isDate(key)) {
qstr = ListAppend(qstr, URLDecode(LCase(key)) & delim1 & URLDecode(struct[key]), delim2);
dump(qstr); abort;
} else {
qstr = ListAppend(qstr, URLEncodedFormat(LCase(key)) & delim1 & URLEncodedFormat(struct[key]), delim2);
}
}
return qstr;
}
}
gsr
07/30/2022, 3:31 PMAdam Cameron
key
has? IE: did you do any debugging as to why the code around the date stuff might not be working the way you want?
Also... you only specify one parameter to your function, but you then actually use up to three of them. Just to keep your code clear, you should be specifying all the parameters. Because it's pretty hard to work out why you have written this code the way you have, with the messing around with the delimiters you're doing.
Also(2)... does your function really return any? Or does it return a string? Even the function says it returns a string in its name, so then the return type should also be a string.gsr
07/30/2022, 3:51 PM