I\'m trying to convert my current Delphi 7 Win32 code to Delphi XE5 Android with minimal changes, so that my project can be cross-compiled to Win32 from a range of Delphi versio
As LU RD told above Low
and High
functions for string were only introduced in XE3. So how can you use functions in earlier Delphi verions, that are missed? Just the same way as always do - if the function is missed - go and write it!
You should only activate those compatibility additions for Delphi beyond XE3 version, using conditional compilation. One way is described in other answers, using >= comparison. Another usual way would be reusing jedi.inc definitions file.
Then for earlier Delphi versions you would add your own implementations of those, like
function Low(const S: AnsiString): integer; overload;
Pay attention to the overload
specifier - it is what would make the trick possible, don't forget it!
You would have to write 4 functions for Delphi 7 till 2007, covering combinations of Low/High
fn name and AnsiString/WideString
data type.
For Delphi 2009 till XE2 you would have to add two more functions for UnicodeString
datatype.
And also mark those function inline
for those Delphi versions, that support it (this is where jedi.inc
comes handy again.
Hopefully you don't need supprot for UTF8String
, but if you do - you know what to do about it now (if compiler would manage to tell it from AnsiString when overloading...)