Given a string with an unknown number of spaces at the beginning.
I would like to replace each of the spaces with a
.
ONLY the spaces at the beginning of the string should be replaced.
This:
' This is a string with 3 spaces at the beginning';
Should translate to:
' This is a string with 3 spaces at the beginning'
And this:
' This is a string with 5 spaces at the beginning';
Should translate to:
' This is a string with 5 spaces at the beginning'
I'm looking for a solution that doesn't required looping through the spaces of the string.