I want to insert some text before a substring in a string.
For example:
str = "thisissometextthatiwrote"
substr = "text"
inserttxt = "XX"
I want:
str = "thisissomeXXtextthatiwrote"
Assuming substr can only appear once in str, how can I achieve this result? Is there some simple way to do this?