Using your example in modern Delphi versions will always show a warning regardless of what string compiler directives you use in your code. Why? That is because the Format function is always returning default Delphi string type which is WideString, And since you are then assigning it to AnsiString you get a warning.
So you either need to create your own version of Format function that will be returning AnsiString result or disable of using of LongString as default string type at Project Options->Building->Delphi Compiler->Compiling (check Syntax options section).
http://docwiki.embarcadero.com/RADSt...o/en/Compiling
Do note that this affects your entire project so if you have other code parts that are built to work with Unicode string they may stop working properly.
Bookmarks