The following script mimics the @Explode function in the Notes formula language.
function explode(inputstring, separators, includeEmpties) { inputstring = new String(inputstring); separators = new String(separators); if(separators == "undefined") { separators = " :;"; } fixedExplode = new Array(1); currentElement = ""; count = 0; for(x=0; x < inputstring.length; x++) { char = inputstring.charAt(x); if(separators.indexOf(char) != -1) { if ( ( (includeEmpties <= 0) || (includeEmpties == false)) && (currentElement == "")) { } else { fixedExplode[count] = currentElement; count++; currentElement = ""; } } else { currentElement += char; } } if (( ! (includeEmpties <= 0) && (includeEmpties != false)) || (currentElement != "")) { fixedExplode[count] = currentElement; } return fixedExplode; }
Requires Free Membership to View
Register today to access targeted resources from our editorial writers and independent industry experts focused on Lotus Domino, Notes, Workplace and other related technologies.
This was first published in May 2002