获取QString最后一个字符

本文阅读 1 分钟
首页 应用开发 正文

1.Qt Helper

const QChar QString::at(int position) const
Returns the character at the given index position in the string.
The position must be a valid index position in the string (i.e., 0 <= position < size()).

2.示例

最后一个字符位置即字符串长度-1

    QString str = "hello world";
    qDebug() << "string at end: " << str.at(str.size() - 1);
本文来自投稿,不代表本站立场,如若转载,请注明出处:
PHP实现无限级分类
« 上一篇 12-08
Typecho批量删除待审核评论
下一篇 » 02-26