Just wanted to verify some thought regarding split function. I have constructed a simple code.
var array1 = [{}];
var string1 = "A, B, C, D";
array1 = string1.split(",");
The problem is based on this kind of coding for example in flash. The string1 will split all "," then transfers it to the array1 in this format ["A","B","C", "D"]. Is this kind of concept similar to Google Spreadsheet – GAS? If yes can you site some example? Thanks a lot guys.
P.S: When I tried splitting the "," it only returns the value "A B C D" as a single element.
Thanks,
Nash 🙂
Your code should definitely work, I just ran this with a breakpoint on
Logger.log(array1);The debugger shows it as an array, and the log logs it as:[A, B, C, D]. Note, that to get the output you wanted I had to add a space to the split to get:string1.split(", ");