Quote:
|
Originally Posted by ApothiX
Return the delimiters? Why would you want that? Just add them manually to whatever you're doing if you need them that badly.
I, for one, would rather not have commas and other crap in my tokens to make them look ugly :|
|
you seriously underestimate their usefulness... although, i did make a function that does it in a really really ugly sense... kindof taking advantage of how string lists are interpreted as arrays.
PHP Code:
function tokenizeWithDelims(string,delims) {
temp.list = "";
for (i=0; i<string.length(); i++) {
if (delims.pos(string.charat(i)) == -1)
temp.list @= string.charat(i);
else {
if (i != 0)
temp.list @= ",";
temp.list @= string.charat(i);
if (i != string.length()-1)
temp.list @= ",";
}
}
return temp.list;
}