此篇博客核心介绍QT中的QString类型的常用函数,介绍到的函数均从帮助手册或其他博客中看到

QString 字符串类
| Header: |
#include |
| qmake: |
QT += core |
一、QString字符串转换
1、QString类字符串转换为整数
int toInt(bool *ok = Q_NULLPTR, int base = 10) const
long toLong(bool *ok = Q_NULLPTR, int base = 10) const
short toShort(bool *ok = Q_NULLPTR, int base = 10) const
uint toUint(bool *ok = Q_NULLPTR, int base = 10) const
ulong toUlong(bool *ok = Q_NULLPTR, int base = 10) const
注:上述函数参数缺省时,缺省表示从十进制的字符串转换为整型,如果指定参数,则可以将二进制、十六进制字符串转换为整数。

本文详细介绍了QT中QString类的常用函数,包括字符串转换(整数、浮点数)、内容修改、大小写转换、字符计数、空格处理、位置查找以及字符串分割等操作。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



