Recently I asked this question: Removing up to 4 spaces from a string
and it works just fine. I am interested however in counting the number of spaces I have removed as well. How can I do this? Count the number of spaces removed using this?
stringArray[i] = stringArray[i].replaceFirst ("^ {0,4}", "");
Basically, I need to be able to remove up to 4 spaces from a string, and then save in an int how many spaces were actually removed. Any help on this would be great!
Thanks!
Here’s one simple way: