strreplace for Houdini 7.0.231

   4121   4   3
User Avatar
Member
4 posts
Joined:
Offline
I would love to be able to use strreplace in Houdini 7. I know it is in 8, but is there a way to get the function and custom install it into houdini 7?
User Avatar
Staff
3455 posts
Joined: July 2005
Offline
could you use “opchange” in the mean time?



OT : hey Kevin! how's things? your OTLs are still mailing people here LOL
Michael Goldfarb | www.odforce.net
Training Lead
SideFX
www.sidefx.com
User Avatar
Member
7025 posts
Joined: July 2005
Offline
Antoine Durr at R+H wrote one as a custom expression. His is really tricky, you have to escape things (if you want to match spaces or punctuation) and stuff that I've forgotton. I'm not sure if he reads this…

Cheers,

Peter B
User Avatar
Member
57 posts
Joined: July 2005
Offline
This RFE has been submitted to our database (ID=20839).
User Avatar
Member
321 posts
Joined: July 2005
Offline
pbowmar
Antoine Durr at R+H wrote one as a custom expression. His is really tricky, you have to escape things (if you want to match spaces or punctuation) and stuff that I've forgotton. I'm not sure if he reads this…

Cheers,

Peter B

Nah, not that complicated. That was another function that backslashed all the quotes!

Here's a simple strreplace:

string strreplace(string srcstr; string replace; string with)
{
float i = -1;
string left = “”;
string right = srcstr;

i = index(right, replace);
while (i >= 0) {

left = left + substr(right, 0, i) + with;
right = substr(right, i+strlen(replace), 999);

i = index(right, replace);
}

return left+right;
}


– Antoine
Antoine Durr
Floq FX
antoine@floqfx.com
_________________
  • Quick Links