1. std::to_string

Convert numerical value to string

Returns a string with the representation of val.

 

The format used is the same that printf would print for the corresponding type:

 

type of valprintf equivalentdescription
int "%d" Decimal-base representation of val.
The representations of negative values are preceded with a minus sign (-).
long "%ld
long long "%lld
unsigned "%u" Decimal-base representation of val.
unsigned long "%lu
unsigned long long "%llu
float "%f" As many digits are written as needed to represent the integral part, followed by the decimal-point character and six decimal digits.
inf (or infinity) is used to represent infinity.
nan (followed by an optional sequence of characters) to represent NaNs (Not-a-Number).
The representations of negative values are preceded with a minus sign (-).

 

posted @ 2021-01-29 09:36  unicornsir  阅读(105)  评论(0编辑  收藏  举报