QString截取字符串
时间: 2024-05-18 18:14:12 浏览: 114
可以使用QString类的mid(int position, int n = -1)函数来截取字符串。其中,position表示截取的起始位置,n表示截取的字符个数,默认为-1,表示截取从起始位置到字符串末尾的所有字符。例如,如果有一个QString对象str,想要从第3个字符开始截取4个字符,可以使用str.mid(2, 4)来实现。 <span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [Qt QString字符串分割、截取](https://blog.csdn.net/qq_17313923/article/details/115655088)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [QString的常用方法(小结)](https://download.csdn.net/download/weixin_38570202/13759912)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文