strreplace for Houdini 7.0.231
4121 4 3- kgillen
- Member
- 4 posts
- Joined:
- Offline
- goldfarb
- Staff
- 3455 posts
- Joined: July 2005
- Offline
- pbowmar
- Member
- 7025 posts
- Joined: July 2005
- Offline
- tsang
- Member
- 57 posts
- Joined: July 2005
- Offline
- Antoine Durr
- 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
-
- Quick Links