#2
yiyanxiyin2023-10-08 17:48
|
今天看到QT两个字符串函数first()和last(),在自己机器的QT环境报错无此函数。环境:deepin 20.9,QT 5.15。
/home/hrhh-zengfc/qttest/sampl04_02_01/widget.cpp:-1: In member function ‘void Widget::on_pushButton_23_clicked()’:
/home/hrhh-zengfc/qttest/sampl04_02_01/widget.cpp:62: error: ‘class QString’ has no member named ‘first’
QString str3 = str1.first(N + 1);
^~~~~
/home/hrhh-zengfc/qttest/sampl04_02_01/widget.cpp:64: error: ‘class QString’ has no member named ‘last’; did you mean ‘at’?
str3 = str1.last(str1.size() - N - 1);
^~~~
请大神指教。