1 Qstring::arg ()//replace string with string variable parameter • Minimum value
Example 1:
QString str;
str = QString ("%1 is born in%2."). Arg ("John"). Arg (1992);//srt = "John is born in 1992.";
Where%1 was substituted for "John"%2 was replaced by "1992"
Example 2:
QString i = "ITest"; //Current file ' s number
QString total = "Totaltest"; // number of files to process
QString fileName = "Filenametest"; //Current file ' s name
QString status = QString ("processing file%1 of% 2:%3"). Arg (i). Arg (total). Arg (fileName);
The result is: "Processing file iTest of Totaltest:filenametest"
2
QString str = " 123 4 ";
str = str.trimmed ();//Remove the white space character of the 2 end of the string as the result of "123 4"
str = str.simplified ();//Remove the white space character of the 2 end of the string using a single whitespace character "" Instead of the white space characters that appear in the string result is "123 4"
QString str = "1234";
QString str1 = "Abxd";
str = Str.insert (1, ' C ');//Insert another string or character at a specific location in the original string
str = str.insert (1, "QQ");
Qdebug () <<str;//"1c234"
4 prepend ();//Insert another string at the beginning of the original string
5
QString str = "1234";
str = str.replace ("Qwer");//from the first position of the string, use the string in parentheses instead of the original number of characters
Qdebug () <<str;//results for "1qwer4"
Some function descriptions about qstring