Contains useful set of functions to work with std::string and to convert various types in std::string. More...
#include <string>#include <sstream>#include <iomanip>Go to the source code of this file.
Functions | |
| int | CppTools::utf8_strlen (const std::string &str) |
| Returns the length of the std::string type variable. | |
| std::string | CppTools::DtoStr (const double val, const int precision=2) |
| Converts double to std::string with the given precision. | |
| std::string | CppTools::RemoveObsoletePrecision (std::string str) |
| Removes every 0 until first non-zero value from right to left after the dot. | |
| std::string | CppTools::RemoveObsoletePrecision (const double value) |
| Converts to std::string and removes every 0 until first non-zero value from right to left after the dot. | |
| std::string | CppTools::BtoStr (const bool val) |
| Converts bool into std::string. | |
Contains useful set of functions to work with std::string and to convert various types in std::string.
In order to use functions from this file libStrTools.so must be loaded
This file is a part of a project CppTools (https://github.com/Sergeyir/CppTools).
| std::string CppTools::BtoStr | ( | const bool | val | ) |
Converts bool into std::string.
| [in] | val | bool variable |
| [out] | boolalpha | string variable that is either "true" or "false" |
| std::string CppTools::DtoStr | ( | const double | val, |
| const int | precision = 2 ) |
Converts double to std::string with the given precision.
| [in] | val | value to be converted |
| [in] | precision | floating point precision |
| [out] | string | converted into string value |
| std::string CppTools::RemoveObsoletePrecision | ( | const double | value | ) |
Converts to std::string and removes every 0 until first non-zero value from right to left after the dot.
Example: if the value is 5.240100 the function will return "5.2401"
| [in] | value | variable to be converted and "trimmed" of the obsolete precision |
| [out] | str | input variable with obsolete precision removed |
| std::string CppTools::RemoveObsoletePrecision | ( | std::string | str | ) |
Removes every 0 until first non-zero value from right to left after the dot.
Example: if the value is "5.240100" the function will return "5.2401"
| [in] | str | string representation of floating point variable |
| [out] | str | input variable with obsolete precision removed |
| int CppTools::utf8_strlen | ( | const std::string & | str | ) |
Returns the length of the std::string type variable.
| [in] | str | stringh the length of which will be returned |
| [out] | length | the length of the passed string |