Languages

Menu
Sites
Language
Bug in Tizen::Base::String::Replace(?)

Hi there,

Running the following code:

             String myString = L"6";
            String copyString = myString;
            AppLog("myString=[%S]   copyString=[%S]", myString.GetPointer(), copyString.GetPointer());
            copyString.Replace(L"6", L"");
            AppLog("myString=[%S]   copyString=[%S]", myString.GetPointer(), copyString.GetPointer());

            String myString2 = L"66";
            String copyString2 = myString2;
            AppLog("myString2=[%S]   copyString2=[%S]", myString2.GetPointer(), copyString2.GetPointer());
            copyString2.Replace(L"6", L"");
            AppLog("myString2=[%S]   copyString2=[%S]", myString2.GetPointer(), copyString2.GetPointer());
Results in:
> myString=[6]   copyString=[6]
 > myString=[]   copyString=[]
 > myString2=[66]   copyString2=[66]
 > myString2=[66]   copyString2=[]

This is not ok, String::Replace() works differently if String length is 1 or 2.
After Replace(), either myString2 should be empty as well, or myString1 should remain "6",

Note that, this is related to the copy constructor somehow, as if I create copyString as:

String copyString;
copyString.Append( myString );

Then it is ok, myString remains "6".

 
Edited by: Brock Boland on 17 Mar, 2014 Reason: Paragraph tags added automatically from tizen_format_fix module.

Responses

1 Replies
you can report this bug to: bugs.tizen.org