Copy link to clipboard
Copied
How can replace widestring to other widestring?
WideString strContent=WideString("this is <a/> and <a/> is data");
WideString strValue=WideString("ABC");
I want replace tag <a/> to text "ABC";
I see sdk doc has replace function, but not exist find function :
WideString & replace (const WideString::const_iterator &b, const WideString::const_iterator &e, const WideString &s)
How can find const_iterator start, end?
Hi @daitranthanhoa,
You can create the iterator explicitly using its constructor. See the sample code below, it should work I could not test it
WideString strContent=WideString("this is <a/> and <a/> is data");
WideString strValue=WideString("ABC");
int32 a = strContent.IndexOf(WideString("<a/>"));
while(a >= 0)
{
strContent.replace(WideString::const_iterator(&strContent, a), WideString::const_iterator(&strContent, a + 4), strValue);
a = strContent.IndexOf(Wid
...
Copy link to clipboard
Copied
Hi @daitranthanhoa,
You can create the iterator explicitly using its constructor. See the sample code below, it should work I could not test it
WideString strContent=WideString("this is <a/> and <a/> is data");
WideString strValue=WideString("ABC");
int32 a = strContent.IndexOf(WideString("<a/>"));
while(a >= 0)
{
strContent.replace(WideString::const_iterator(&strContent, a), WideString::const_iterator(&strContent, a + 4), strValue);
a = strContent.IndexOf(WideString("<a/>"));
}
-Manan