THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/02/2012 at 16:45, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R13
Platform: Windows ; Mac ;
Language(s) : C++ ;
---------
Hey Everyone,
I am trying to create a function that parses an existing string, looks for a specific string, and then replaces that string with another.
I found on the forums here a good example of someone doing this..
Here's that function.
//Replace
//==========================================//
String MyClass::Replace(String orig, String search, String replacement)
{
String res = orig;
LONG i = 0;
while (res.FindFirst(search, &i, i)) {
res.Delete(i, search.GetLength());
res.Insert(i, replacement);
}
return res;
}
Now if the search string and the replacement string are the same exact size, this works just fine, but if the search string is for example "X" and the replace string is "[X]", then C4D freezes up. In fact any time I try to replace a single character with a larger string c4d crashes.. Is there a better way to accomplish this? Or maybe a way to resize the string without crashing c4d?
Thanks,
Shawn