Hey! Hope everyone is doing well.
I basically want to replace a character in a string at a specific index. Now, I can’t really convert this to a list using
String.graphemes and then recursing over it cause the indexes I am getting is from a list as well and both are of different sizes.
In simpler terms, I have the following list called
mylist with the values:
[3, 7] and a string called
str with characters
123+*12-+3456. Now, the contents inside
mylist are the indexes at which I want to replace the characters in the string.
In other words, for the above example, I want to replace the character at index
3, which is
+. Similarly, I want to replace the character at index
7. The final string I would get is
I tried using a combination of
String.replace, however, the latter replaces all the characters. Is there an efficient way of doing this?