Hello Martin,
I would like to replace part of string at a given index position. Existing replace() and replaceAll() replaces everything that match search string.
Is there a way to realize something like:
string myreplace(string ori, num startidx, num lenght, string replace)
startidx=position at which one starts to replace
length=number of indices to be replaced
For example:
myreplace("haha", 1, 3,"ello")
It will return "hello"
Regards
Andy
Advanced string replace()
Moderator: Martin
Re: Advanced string replace()
Hi,
You could use function substring to extract the first and second part:
v = "haha";
t = substring(v, 0, 1) + "ello" + substring(v, 4);
Regards,
Martin
You could use function substring to extract the first and second part:
v = "haha";
t = substring(v, 0, 1) + "ello" + substring(v, 4);
Regards,
Martin
Re: Advanced string replace()
Hi Martin,
Thanx for reply. I was looking for a workaround but I did not notice substring instruction.
I think a combination of replace and substring will give a solution.
Regards
Andy
Thanx for reply. I was looking for a workaround but I did not notice substring instruction.
I think a combination of replace and substring will give a solution.
Regards
Andy