语言

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".

 
编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

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