Skip to content

Instantly share code, notes, and snippets.

@mattmawhinney
Created January 19, 2018 11:57
Show Gist options
  • Save mattmawhinney/d77c8ec16c4989f823eb50d7ade21660 to your computer and use it in GitHub Desktop.
Save mattmawhinney/d77c8ec16c4989f823eb50d7ade21660 to your computer and use it in GitHub Desktop.
Custom Code for Google Sheets Function
function corSPLIT(input) {
function splitValue(value, index) {
//console.log(value.substring(0, index+1) + "#" + value.substring(index+1));
return value.substring(0, index+1) + "#" + value.substring(index+1);
}
var corNumA = input.split("");
//console.log(corNumA);
var splitSpot;
for (i = 0; i < corNumA.length; i++) {
var curr = corNumA[i];
var next = corNumA[i+1];
if (curr == "0") {
if (next != "0" && next != "1" && next != "2" && next != "3" && next != "4" && next != "5" && next != "6" && next != "7" && next != "8" && next != "9") {
var splitSpot = i;
{ break; }
}
}
}
//console.log(splitSpot);
splitValue(corNum,splitSpot);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment