std::to_string
提供: cppreference.com
< cpp | string | basic string
![]() |
このページは、Google 翻訳を使って英語版から機械翻訳されました。
翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <string>
|
||
std::string to_string( int value ); |
(1) | (C++11およびそれ以降) |
std::string to_string( long value ); |
(2) | (C++11およびそれ以降) |
std::string to_string( long long value ); |
(3) | (C++11およびそれ以降) |
std::string to_string( unsigned value ); |
(4) | (C++11およびそれ以降) |
std::string to_string( unsigned long value ); |
(5) | (C++11およびそれ以降) |
std::string to_string( unsigned long long value ); |
(6) | (C++11およびそれ以降) |
std::string to_string( float value ); |
(7) | (C++11およびそれ以降) |
std::string to_string( double value ); |
(8) | (C++11およびそれ以降) |
std::string to_string( long double value ); |
(9) | (C++11およびそれ以降) |
1)
std::sprintf(buf, "%d", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に符号付き10進整数に変換し.Original:
Converts a signed decimal integer to a string with the same content as what std::sprintf(buf, "%d", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
2)
std::sprintf(buf, "%ld", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に符号付き10進整数に変換し..Original:
Converts a signed decimal integer to a string with the same content as what std::sprintf(buf, "%ld", value) would produce for sufficiently large
buf
..The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
3)
std::sprintf(buf, "%lld", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に符号付き10進整数に変換し.Original:
Converts a signed decimal integer to a string with the same content as what std::sprintf(buf, "%lld", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
4)
std::sprintf(buf, "%u", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に符号なし10進整数に変換し.Original:
Converts an unsigned decimal integer to a string with the same content as what std::sprintf(buf, "%u", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
5)
std::sprintf(buf, "%lu", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に符号なし10進整数に変換し.Original:
Converts an unsigned decimal integer to a string with the same content as what std::sprintf(buf, "%lu", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
6)
std::sprintf(buf, "%llu", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に符号なし10進整数に変換し.Original:
Converts an unsigned decimal integer to a string with the same content as what std::sprintf(buf, "%llu", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
@ 7,8 @std::sprintf(buf, "%f", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に浮動小数点値に変換し.Original:
@7,8@ Converts a floating point value to a string with the same content as what std::sprintf(buf, "%f", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
9)
std::sprintf(buf, "%Lf", value)が十分に大きいために生産
buf
れるものと同じ内容の文字列に浮動小数点値に変換し.Original:
Converts a floating point value to a string with the same content as what std::sprintf(buf, "%Lf", value) would produce for sufficiently large
buf
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
目次 |
[編集] パラメータ
value | - | 変換する数値
Original: a numeric value to convert The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[編集] 値を返します
変換された値を保持している文字列
Original:
a string holding the converted value
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[編集] 例
このコードを実行します
#include <iostream> #include <string> int main() { double f = 23.43; std::string f_str = std::to_string(f); std::cout << f_str << '\n'; }
出力:
23.430000
[編集] も参照してください
(C++11) |
wstring に整数型または浮動小数点値に変換します Original: converts an integral or floating point value to wstring The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (関数) |