Delphi incompatibility in StartsStr and EndsStr for ASubStr=''
Original Reporter info from Mantis: kluug.net @onpok
-
Reporter name: Ondrej Pokorny
Original Reporter info from Mantis: kluug.net @onpok
- Reporter name: Ondrej Pokorny
Description:
There is a Delphi incompatibility in StartsStr and EndsStr for ASubText=''
Steps to reproduce:
Writeln(BoolToStr(StrUtils.StartsStr('', 'x'), True)); // FPC: False; Delphi 10.4.2: True
Writeln(BoolToStr(StrUtils.StartsStr('', ''), True)); // FPC: False; Delphi 10.4.2: True
Writeln(BoolToStr(StrUtils.EndsStr('', 'x'), True)); // FPC: False; Delphi 10.4.2: True
Writeln(BoolToStr(StrUtils.EndsStr('', ''), True)); // FPC: True ; Delphi 10.4.2: True
Additional information:
Delphi's behavior (=always return True for an empty ASubText) makes more sense for me.
Mantis conversion info:
- Mantis ID: 38580
- Fixed in version: 3.3.1
- Fixed in revision: 48898 (#582e39e9)
- Target version: 3.2.2