I have a string s composed of two strings s1 and s2, s = s1+s2
.
I'd like to be able to modify s1
in another function, and then recompose s
with the modified version of s1
. I'd like to change s1
so that it takes s2
as a paramater. For example, s1 = "1+"
and s2="2"
, and I'd like s to become "incr(" + s2 + ")"
.
I could do that by using s1 = "incr(%s2%)"
and then s1.replace("%s2%",s2)
, but what if s1
already contains "%s2%"
? I'd like it to be as generic as possible.
Is there any way to do that ?