TStringBuilder.Remove bug when deleting everything
Original Reporter info from Mantis: Wallaby
-
Reporter name:
Original Reporter info from Mantis: Wallaby
- Reporter name:
Description:
Using the trunk. There is a bug in the TStringBuilder class in its Remove() method.
The following code throws a range error. The same code works in Delphi correctly.
var
SB: TStringBuilder;
begin
SB := TStringBuilder.Create;
try
SB.Append('ABC');
ShowMessage(SB.ToString);
SB.Remove(0, 3);//fails range check
//SB.Remove(0, 2);//removes AB
ShowMessage(SB.ToString);
finally
SB.Free;
end;
Steps to reproduce:
Run the above code. Note when deleting the first two letters (0, 2) it works as it should and removes AB.
Deleting all three letters throws a range check error, while it should just delete ABC and leave the string builder empty.
Mantis conversion info:
- Mantis ID: 38063
- Build: Trunk
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 47392 (#4a38d1b3)
- Target version: 3.2.2