2 things:
First off, it looks like that function doesn't take a string/char array, it takes a single character, and replaces only that.
TextString has String::contains(char* Substring), but no replacement functions, as far as I can tell.
Try something like this, maybe:
//using 'MyString' to represent whatever your string is
char * MyString = whateveryourstringis.
//we find every instance of the string to delete, and cut it out
char * string_to_delete = "<data value=";
int length_to_delete = strlen(string_to_delete);
char * start_of_deleted_data = strstr(MyString,string_to_delete);
//strstr will return a NULL pointer if the substring wasn't found
//otherwise, it will return a pointer to the start of the substring
while(start_of_deleted_data != NULL)
{
//delete the substring, by shifting everything in the string over by length_to_delete
for (int i=0; i<length_to_delete; i++)
{
start_of_deleted_data[i] = start_of_deleted_data[i+length_to_delete];
}
//search for the next instance of the string
char * start_of_deleted_data = strstr(MyString,string_to_delete);
}
My code there is NOT complete. At least one error I can see right away is that it will go a bit crazy if your string to delete is at the very end or near the end of your big string.
The second problem, that any solution will have, is possible memory leaks. If you're allocating your strings dynamically (using malloc), which is what TextString seems to do, then when you shorten a string, you have to make sure to free() the freed area.
If you allocate statically (declaring a big buffer, and using that), you can just overwrite that whenever new data comes in.
Let me know if this is helpful at all.
edit: I realize my example code can be kind of thick if you're not familiar with pointers or string manipulation, so I'll try to find some useful links, and explain my code a bit better, if you want.