Export (0) Print
Expand All

to_string

Converts a value to a string.

string to_string(int Val);
string to_string(unsigned int Val);
string to_string(long Val);
string to_string(unsigned long Val);
string to_string(long long Val);
string to_string(unsigned long long Val);
string to_string(float Val);
string to_string(double Val);
string to_string(long double Val);

Parameter

Description

Val

The value to be converted.

The string that represents the value.

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

  • "%d" if Val has type int

  • "%u" if Val has type unsigned int

  • "%ld" if Val has type long

  • "%lu" if Val has type unsigned long

  • "%lld" if Val has type long long

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

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

  • "%Lf" if Val has type long double

The function returns string(Buf).

Header: <string>

Namespace: std

Show:
© 2014 Microsoft