-
Most efficient way of injecting line breaks
As part of a larger expression, I need to inject line breaks after each character in a string. I have something that works (hacked together from another post here), but was wondering if there is a more efficient method, since I’ll need to be doing this to multiple strings at once.
idx = 0;
outStr = "";
while (idx < value.length){
if (idx > 0) outStr += "\r";
outStr += value.substr(idx,1);
idx += 1;
}
outStr