[fpc-devel] Format Function

Michael Van Canneyt michael at freepascal.org
Tue Jan 29 10:36:45 CET 2019



On Mon, 28 Jan 2019, Amir at Aavani.net wrote:

> Hi,
>
>   I am looking for a version of Format function that works with 
> WideStrings. One way to implement this is to use something like the 
> folllowing:
>
> function GetNames(const FirstName, LastName: WideString; ID: Integer): 
> WideString;
> begin
>   Result := ReadWideString(Format('%d %s %s', [ID, 
> WideStringToUTF8(Name1), WideStringToUTF8(Name2)])
> end;
>
> Is there any better way to do this?

You can use the native functions:

https://www.freepascal.org/docs-html/current/rtl/sysutils/wideformat.html
https://www.freepascal.org/docs-html/current/rtl/sysutils/unicodeformat.html

Michael.


More information about the fpc-devel mailing list