Angus Robertson 574 Posted June 26, 2020 To save me looking at lots of old compilers, does anyone know in which version of Delphi that Pos got an extra argument to become equivalent to PosEx in D2007? Hopefully D2009? Angus Share this post Link to post
Bill Meyer 337 Posted June 26, 2020 (edited) Can't tell you when it was added, but it is present in D2007. Edited June 26, 2020 by Bill Meyer Share this post Link to post
Angus Robertson 574 Posted June 26, 2020 PosEx was available in Delphi 2007, but became obsolete in XE3 when Pos got a third offset argument. function Pos(const SubStr, Str: UnicodeString; Offset: Integer = 1): Integer; Abgus Share this post Link to post
Stefan Glienke 2002 Posted June 26, 2020 Delphi XE3 because I have this code in Spring.pas: {$IFNDEF DELPHIXE3_UP} function Pos(const SubStr, Str: UnicodeString; Offset: Integer): Integer; asm jmp PosEx end; {$ENDIF} 1 Share this post Link to post
Remy Lebeau 1396 Posted June 26, 2020 5 hours ago, Angus Robertson said: PosEx was available in Delphi 2007 PosEx() was introduced in Delphi 7. 5 hours ago, Angus Robertson said: but became obsolete in XE3 when Pos got a third offset argument. Confirmed. The Offset parameter is not present in Pos() in XE2, but is present in XE3. Share this post Link to post
Bill Meyer 337 Posted June 27, 2020 12 hours ago, Angus Robertson said: PosEx was available in Delphi 2007, but became obsolete in XE3 when Pos got a third offset argument. function Pos(const SubStr, Str: UnicodeString; Offset: Integer = 1): Integer; In D2007, I have the Offset argument. Share this post Link to post
Remy Lebeau 1396 Posted June 29, 2020 (edited) On 6/26/2020 at 6:34 PM, Bill Meyer said: In D2007, I have the Offset argument. In D2007, there is no Offset parameter in Pos(), only in PosEx(). Here are the declarations from D2007: System.pas function Pos(const substr, str: AnsiString): Integer; overload; function Pos(const substr, str: WideString): Integer; overload; StrUtils.pas function PosEx(const SubStr, S: string; Offset: Integer = 1): Integer; For comparison, here are the declarations from XE2, before the Offset parameter was added to Pos(): System.pas function Pos(const SubStr, Str: ShortString): Integer; overload; function Pos(const SubStr, Str: UnicodeString): Integer; overload; function Pos(const SubStr, Str: WideString): Integer; overload; function Pos(const SubStr, Str: RawByteString): Integer; overload; System.StrUtils.pas function PosEx(const SubStr, S: string; Offset: Integer = 1): Integer; overload; System.AnsiStrings.pas function PosEx(const SubStr, S: AnsiString; Offset: Integer = 1): Integer; overload; And here are the declarations from XE3, when the Offset parameter was added to Pos(): System.pas function Pos(const SubStr, Str: _ShortStr; Offset: Integer = 1): Integer; overload; function Pos(const SubStr, Str: UnicodeString; Offset: Integer = 1): Integer; overload; function Pos(const SubStr, Str: _WideStr; Offset: Integer = 1): Integer; overload; function Pos(const SubStr, Str: _RawByteStr; Offset: Integer = 1): Integer; overload; System.StrUtils.pas function PosEx(const SubStr, S: string; Offset: Integer = 1): Integer; inline; overload; System.AnsiStrings.pas function PosEx(const SubStr, S: AnsiString; Offset: Integer = 1): Integer; inline; overload; Edited June 29, 2020 by Remy Lebeau 1 Share this post Link to post
Bill Meyer 337 Posted June 29, 2020 12 minutes ago, Remy Lebeau said: In D2007, there is no Offset parameter in Pos(), only in PosEx(). Here are the declarations from D2007: You are correct, of course. I think I copied that from help, though. Should have checked more closely. Share this post Link to post