共用方式為


to_wstring

Converts a value to a wide string.

wstring to_wstring(int Val);
wstring to_wstring(unsigned int Val);
wstring to_wstring(long Val);
wstring to_wstring(unsigned long Val);
wstring to_wstring(long long Val);
wstring to_wstring(unsigned long long Val);
wstring to_wstring(float Val);
wstring to_wstring(double Val);
wstring to_wstring(long double Val);

Parameters

Parameter

Description

Val

The value to be converted.

Return Value

The wide string that represents the value.

Remarks

The function converts Val to a sequence of elements stored in an array object Buf internal to the function as if by calling swprintf(Buf, Len, Fmt, Val), where Fmt is

  • L"%d" if Val has type int

  • L"%u" if Val has type unsigned int

  • L"%ld" if Val has type long

  • L"%lu" if Val has type unsigned long

  • L"%lld" if Val has type long long

  • L"%llu" if Val has type unsigned long long

  • L"%f" if Val has type float or double

  • L"%Lf" if Val has type long double

The function returns wstring(Buf).

Requirements

Header: <string>

Namespace: std

See Also

Reference

string (C++ STL <string>)

wstring

<string>