Responsible for conversion between strings and numbers.
More...
#include <sttnet_English.h>
|
| static int & | toInt (const std::string_view &ori_str, int &result, const int &i=-1) |
| | Convert string to int type. More...
|
| |
| static int & | str16toInt (const std::string_view &ori_str, int &result, const int &i=-1) |
| | Convert a hexadecimal number's string representation to a decimal int type number. More...
|
| |
| static long & | toLong (const std::string_view &ori_str, long &result, const long &i=-1) |
| | Convert string to long type. More...
|
| |
| static float & | toFloat (const std::string &ori_str, float &result, const float &i=-1) |
| | Convert string to float type. More...
|
| |
| static double & | toDouble (const std::string &ori_str, double &result, const double &i=-1) |
| | Convert string to double type. More...
|
| |
| static bool & | toBool (const std::string_view &ori_str, bool &result) |
| | Convert string to bool type. More...
|
| |
| static std::string & | strto16 (const std::string &ori_str, std::string &result) |
| | Convert a normal string to its corresponding hexadecimal representation string (hex string). More...
|
| |
Responsible for conversion between strings and numbers.
| static int& stt::data::NumberStringConvertUtil::str16toInt |
( |
const std::string_view & |
ori_str, |
|
|
int & |
result, |
|
|
const int & |
i = -1 |
|
) |
| |
|
static |
Convert a hexadecimal number's string representation to a decimal int type number.
- Parameters
-
| ori_str | String representation of a hexadecimal number |
| result | Int container to save the conversion result |
- Returns
- Reference to result
| static std::string& stt::data::NumberStringConvertUtil::strto16 |
( |
const std::string & |
ori_str, |
|
|
std::string & |
result |
|
) |
| |
|
static |
Convert a normal string to its corresponding hexadecimal representation string (hex string).
For example, input "ABC" will be converted to "414243", and each character is converted to the hexadecimal form of its ASCII.
- Parameters
-
| ori_str | Input original string (can contain any characters, including invisible characters). |
| result | Reference to the string storing the conversion result. |
- Returns
- Reference to the converted hexadecimal string result.
- Bug:
- There is a bug to be fixed
| static bool& stt::data::NumberStringConvertUtil::toBool |
( |
const std::string_view & |
ori_str, |
|
|
bool & |
result |
|
) |
| |
|
static |
Convert string to bool type.
- Note
- Does not throw exceptions, true or True, TRUE return true, otherwise return false
- Parameters
-
| ori_str | Original string type data |
| result | Bool container to store the result |
- Returns
- Reference to result
| static double& stt::data::NumberStringConvertUtil::toDouble |
( |
const std::string & |
ori_str, |
|
|
double & |
result, |
|
|
const double & |
i = -1 |
|
) |
| |
|
static |
Convert string to double type.
- Note
- Does not throw exceptions
- Parameters
-
| ori_str | Original string type data |
| result | Double container to store the result |
| i | If the conversion fails, assign result to i (default is -1) |
- Returns
- Reference to result
| static float& stt::data::NumberStringConvertUtil::toFloat |
( |
const std::string & |
ori_str, |
|
|
float & |
result, |
|
|
const float & |
i = -1 |
|
) |
| |
|
static |
Convert string to float type.
- Note
- Does not throw exceptions
- Parameters
-
| ori_str | Original string type data |
| result | Float container to store the result |
| i | If the conversion fails, assign result to i (default is -1) |
- Returns
- Reference to result
| static int& stt::data::NumberStringConvertUtil::toInt |
( |
const std::string_view & |
ori_str, |
|
|
int & |
result, |
|
|
const int & |
i = -1 |
|
) |
| |
|
static |
Convert string to int type.
- Note
- Does not throw exceptions
- Parameters
-
| ori_str | Original string type data |
| result | Int container to store the result |
| i | If the conversion fails, assign result to i (default is -1) |
- Returns
- Reference to result
| static long& stt::data::NumberStringConvertUtil::toLong |
( |
const std::string_view & |
ori_str, |
|
|
long & |
result, |
|
|
const long & |
i = -1 |
|
) |
| |
|
static |
Convert string to long type.
- Note
- Does not throw exceptions
- Parameters
-
| ori_str | Original string type data |
| result | Long container to store the result |
| i | If the conversion fails, assign result to i (default is -1) |
- Returns
- Reference to result
The documentation for this class was generated from the following file: