How can I replace first N
occurrences of many whitespaces and tabs in the following string:
07/12/2017 11:01 AM 21523 filename with
I'd go with something like this. Though I kinda like Derek's answer so I'll look his up and understand what he/she does in it.
var mytext = "some text separated by spaces and spaces and more spaces";
var iterationCount = 4;
while(iterationCount > 0)
{
mytext = mytext.replace(" ", "");
iterationCount--;
}
return mytext;