问题描述
如何转换这样的字符串"nodeA:valueA | nodeB:valueB |...."排列或映射[已解决],
然后使用指针和值循环数组,并使用指针分配下面的nodeA和valueA [仍在努力寻找答案]?
int nodeA = net.FindNode("nodeA");
neet.GetNode(nodeA)-> Value()-> SetValue(valueA);
谢谢.
How do I convert a string like this "nodeA:valueA|nodeB:valueB|...." to array or map [SOLVED],
then loop the array with key and value and assign nodeA and valueA below, using pointer[Still working hard to find answer]?
int nodeA = net.FindNode("nodeA");
neet.GetNode(nodeA)->Value()->SetValue(valueA);
Thank you.
推荐答案
考虑std :: string和std :: map的组合.
Consider a combination of std::string and std::map.
具有一些贯穿初始字符串的内容(也许是std :: string :: find的循环),并将每个值放入std :: map< std :: string,std :: string>中.
Have something that runs through the initial string (perhaps a loop of std::string::find), and put in each value into a std::map<std::string, std::string>.
这篇关于将字符串分配给变量intifier?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!