Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2019-01

Format Function

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author

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?

Thanks,
Amir

Reply by email

Michael Van Canneyt
to Unknown author
Show quoted text 14 lines
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.

Reply by email