Allocating words from a string separated by spaces to a variable? C++ [qt] [duplicate]

我们两清 提交于 2019-12-02 22:39:05

问题


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.


回答1:


You can do it like:

QString lineText = "some sample words";

QStringList tokens= lineText.split(" ",QString::SkipEmptyParts);

You can do whatever you like with the words in the tokens list.



来源:https://stackoverflow.com/questions/21367276/allocating-words-from-a-string-separated-by-spaces-to-a-variable-c-qt

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!