从空格分隔的字符串中的单词分配给变量? C ++ [qt] [英] Allocating words from a string separated by spaces to a variable? C++ [qt]
本文介绍了从空格分隔的字符串中的单词分配给变量? C ++ [qt]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道什么技术术语分配字符串由空格分隔的一个变量,所以我可以查找一个教程。非常感谢任何条款,链接或解释。
I just wanted to know what the technical term for allocating words from a string separated by spaces to a variable is called so I can look up a tutorial for it. Any terms, links, or explanations would be greatly appreciated.
推荐答案
您可以这样做:
QString lineText = "some sample words";
QStringList tokens= lineText.split(" ",QString::SkipEmptyParts);
您可以对令牌列表中的单词进行任何操作。
You can do whatever you like with the words in the tokens list.
这篇关于从空格分隔的字符串中的单词分配给变量? C ++ [qt]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文