I am trying to implement a logic where I need to replace particular sub-string(no of characters)
in a string from given starting index to end index.
For example:
Suppose there is a string called "elephant"
and I have given starting index as 2
and end index as 5
and i need to replace characters between those indexes with another given string "tiger"
. So the resultant string should be "eltigernt"
.
Similarly,Suppose there is a string called "elephant elephant tiger"
and I have given starting index as 2
and end index as 5
and i need to replace characters between those indexes with another given string "tiger"
. So the resultant string should be "eltigernt elephant tiger"
.