Daily bit(e) of C++

Share this post

Daily bit(e) of C++ | std::stoi, std::stol, std::stoll, std::stoul, std::stoul, std::stof, std::stod, std::stold

simontoth.substack.com

Discover more from Daily bit(e) of C++

Random C++ knowledge organized in arbitrary order.
Over 1,000 subscribers
Continue reading
Sign in

Daily bit(e) of C++ | std::stoi, std::stol, std::stoll, std::stoul, std::stoul, std::stof, std::stod, std::stold

Daily bit(e) of C++ #262, Functions for converting std::string to integer and floating point types: std::stoi, std::stol, std::stoll, std::stoul, std::stoul, std::stof, std::stod, std::stold.

Šimon Tóth
Sep 20, 2023
5
Share this post

Daily bit(e) of C++ | std::stoi, std::stol, std::stoll, std::stoul, std::stoul, std::stof, std::stod, std::stold

simontoth.substack.com
Share

C++11 added functions for converting std::string into integer and floating point types.

Signed integers: std::stoi, std::stol, std::stoll.

Unsigned integers: std::stoul, std::stoull.

Floating point types: std::stof, std::stod, std::stold.

For std::string_view or string literals, prefer the std::from_chars function (to an excessive std::string temporary).

Click to open in Compiler Explorer.

Leave a comment

Thanks for reading Daily bit(e) of C++! Subscribe for free to receive new posts and support my work.

5
Share this post

Daily bit(e) of C++ | std::stoi, std::stol, std::stoll, std::stoul, std::stoul, std::stof, std::stod, std::stold

simontoth.substack.com
Share
Comments
Top
New
Community

No posts

Ready for more?

© 2023 Šimon Tóth
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing