c++ - 将指针字符串转换为整数

标签 c++ string integer pointers

我正在尝试将包含字符串的 treePtr->item.getInvest() 转换为整数。这可能吗?

最佳答案

如果您有权访问 boost:

int number= boost::lexical_cast<int>(treePtr->item.getInvest());

关于c++ - 将指针字符串转换为整数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1655904/

相关文章:

C++ getline 和 append

python - 修复格式错误的字符串?

c - 为什么 'strcat' 函数不起作用?

c++ - 检查 C++ 中的 int 溢出

C++专业代码分析工具

c++ - 如何为我的插件实现自定义数字签名?

c++ - 如何在 4 个字符串之间搜索字符串

regex - PostgreSQL regexp_replace() 只保留一个空格

string - 在 Ocaml 中将字符串连接到整数

c - C 程序中字符输入的整数验证