I'm trying to create a string increaser function that will take one string and raise it up one, for example:
000000 is the first string, then comes 000001, up to 000009 where it then goes onto 00000a up to 00000z.
My idea was that I will replace the last pattern (z) with the first (0), then, get the point where it was replaced and increase that by one in the pattern.
The code I tried to use:
cycler(string) {
//string="00000z"
var pos = string.replace('z', '0');
console.log(pos);
}
I sadly realized that the return of this function was the replaced version, not what I was after. Which makes total logical sense.
I'm wondering if there is a function in JavaScript for this functionality of finding where the all the replaces were made?