我想替换qml中的字符串文本。 例如, 存在QML变体数组。我用它来发短信。
property variant szString: ["", "", "", "", "", "", "", "", "", ""]
和
i do data in szString.
szString[1] = "abcdefg"
szString[2] = "a###b"
...
和
Text: {
text: szString[index]
...
}
我想在此文本中替换字符串。 例如,
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)
请帮助我....
答案 0 :(得分:-1)
while (szString[2].search("#") > -1) szString[2] = szString[2].replace("#"," ")