RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
SysUtils.FormatBuf Function

Formats the arguments from an array, placing the result in a buffer.

Pascal
function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const; const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const; const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format; FmtLen: Cardinal; const Args: array of const; const FormatSettings: TFormatSettings): Cardinal; overload;
C++
unsigned FormatBuf( Buffer, unsigned BufLen, const  Format, unsigned FmtLen, const array of const Args);
unsigned FormatBuf( Buffer, unsigned BufLen, const  Format, unsigned FmtLen, const array of const Args, const TFormatSettings FormatSettings);
unsigned FormatBuf(PWideChar Buffer, unsigned BufLen, const  Format, unsigned FmtLen, const array of const Args);
unsigned FormatBuf(UnicodeString Buffer, unsigned BufLen, const  Format, unsigned FmtLen, const array of const Args);
unsigned FormatBuf(PWideChar Buffer, unsigned BufLen, const  Format, unsigned FmtLen, const array of const Args, const TFormatSettings FormatSettings);
unsigned FormatBuf(UnicodeString Buffer, unsigned BufLen, const  Format, unsigned FmtLen, const array of const Args, const TFormatSettings FormatSettings);

This function formats the series of arguments in the specified open array into a text buffer. 

Buffer is the text buffer that receives the results. 

BufLen is the number of bytes in Buffer. 

Format is the format string that determines how arguments are formatted. For information on the format strings, see Format Strings. 

FmtLen is the number of bytes in Format

Args are the arguments that replace the format specifiers in Format.

Note: Args_Size is the index of the last element in Args (one less than the number of arguments).
FormatBuf function returns the length, in bytes, of the resulting string. 

The first form of FormatBuf is not thread-safe, because it uses localization information contained in global variables. The second form of FormatBuf, which is thread-safe, refers to localization information contained in the FormatSettings parameter. Before calling the thread-safe form of FormatBuf, you must populate FormatSettings with localization information. To populate FormatSettings with a set of default locale values, call GetLocaleFormatSettings

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!