Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何替换QT-QML中的变量数组文本_C++_Qt_Qml - Fatal编程技术网

C++ 如何替换QT-QML中的变量数组文本

C++ 如何替换QT-QML中的变量数组文本,c++,qt,qml,C++,Qt,Qml,我想替换qml中的字符串文本。 例如 存在QML变量数组。我经常发短信 property variant szString: ["", "", "", "", "", "", "", "", "", ""] 及 及 我想替换此文本处的字符串。 比如说, i want szString[2].replace("#"," "). (i want result -- szString[2] = "a b" ) but, the QML language can't apply.(szStr

我想替换qml中的字符串文本。 例如 存在QML变量数组。我经常发短信

property variant    szString: ["", "", "", "", "", "", "", "", "", ""]

我想替换此文本处的字符串。 比如说,

i want szString[2].replace("#"," "). (i want result -- szString[2] = "a   b" )
but, the QML language can't apply.(szString.replace("#"," ") can apply, but this result isn't... i don't want result)

请帮助我……

您当前的输出是什么?请格式化您的代码。可能您需要的是:
szString[2]。替换(new RegExp(“[#]+”,“g”),”)
我需要szString[2]。替换(“#“,”)。(我想要结果--szString[2]=“ab”)
那是什么样的编程语言?请确保代码块包含可运行的代码,并且代码块中没有其他文本(正确标记注释中的appart)。
while (szString[2].search("#") > -1) szString[2] = szString[2].replace("#"," ")
i want szString[2].replace("#"," "). (i want result -- szString[2] = "a   b" )
but, the QML language can't apply.(szString.replace("#"," ") can apply, but this result isn't... i don't want result)
while (szString[2].search("#") > -1) szString[2] = szString[2].replace("#"," ")