Say there is a specific string : bacdefaxyza
.
Now the character a
is repeated 3 times. I now want to be able to delete or replace with ""
only the a
in the middle but not all. Is there a way to do so? i.e. : I need to be able to delete that a
from any place I wish ( index of that character is known ). Is it possible?
I tried using the replace()
function but it deletes only the first occurrence, or more, but not at a particular index/place that I need.