Where can I find an overview of type conversion, e.g. string to integer, etc.?
Because of the comments so far, I'll clarify: I'm looking for a list /table that says: To convert a string to an int, use: ... And same for other data types (where possible): double to int, char to string, ...
If it's string to/from other types then stringstream or boost::lexical_cast.
For other types it will depend on the types, but maybe look up the standard cast templates? static_cast and dynamic_cast should do most things you need, or there is const_cast and reinterpret_cast which tend to only be useful for dealing with legacy systems.
Streams are essentially C++'s string conversion operators.
You also have available C's conversion method of sprintf, but that is massively error-prone and unsafe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With