共用方式為


to_string

Converts a value to a string.

string to_string(long long _Val);
string to_string(unsigned long long _Val);
string to_string(long double _Val);

Parameters

Parameter

Description

_Val

The value to be converted.

Return Value

The 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 sprintf(_Buf, _Fmt, _Val), where _Fmt is "%lld" if _Val has type long long, "%llu" if _Val has type unsigned long long, or "%Lg" if _Val has type long double. The function returns string(_Buf).

Requirements

Header: <string>

Namespace: std

See Also

Reference

string (<string>)

wstring

<string>

Other Resources

<string> Members