From RAD Studio API Documentation
Jump to: navigation, search


UnicodeString& __cdecl         sprintf(const wchar_t* format, ...); // Returns *this


Type Visibility Source Unit Parent
function public ustring.h System UnicodeString


Sets the value of UnicodeString, given the format string and its arguments.

Use sprintf to set to the value of the UnicodeString instance, given a standard C++ format specifier. Pass the values to any arguments in the format specifier as additional parameters following the format parameter.

This method returns a reference to the UnicodeString instance (*this) with the resulting value.

Warning: The value returned by UnicodeString.c_str() under OS X and iOS is char16_t* while the sprintf function expects wchar_t*.
  • UnicodeString.sprintf() does not support %ls on the OS X platform.
  • The System::String::sprintf is implemented using each OS' vprintf. As such, the various format specifiers support across each platform may differ. For example, Windows supports %ls while most POSIX platforms do not. Some platforms, like Android, expect UTF-8 encoded data w/ %s, while Windows expects ANSI-encoded data.

See Also