Remove Parts of a String
-
Hello again,
im Looking to solve the fallowing, and i am Looking for ideas.
The string Looks like: Eintrag_2 { ExternalWritable := 'False'} : Bool;
and i want to remove { …} the curly bracket and everything between it. Does that just work with a parser or does the RegularExpressions have some Tools to do the Job?
-
Hello again,
im Looking to solve the fallowing, and i am Looking for ideas.
The string Looks like: Eintrag_2 { ExternalWritable := 'False'} : Bool;
and i want to remove { …} the curly bracket and everything between it. Does that just work with a parser or does the RegularExpressions have some Tools to do the Job?
This is depending on the complexity of text between curled braces. However, I would try first with QRegularExpression.
-
If someone wants to do the same, i did it with the fallowing Code:
int l_indexAnfang, l_indexEnde, l_deleteWeite;
l_indexAnfang = p_String.indexOf(QRegularExpression("{"),0);
l_indexEnde = p_String.indexOf(QRegularExpression("}"),0);
l_deleteWeite = l_indexEnde - l_indexAnfang + 1;
p_String = p_String.remove(l_indexAnfang, l_deleteWeite); -
p_String.replace(QRegularExpression(QStringLiteral("{.*}")),QString());
-
Evene better. What is the Macro inside the Expression good for?
Does this just "create" the string while compiling so it hasnt to be created in the runtime anymore?
-
Evene better. What is the Macro inside the Expression good for?
Does this just "create" the string while compiling so it hasnt to be created in the runtime anymore?
@meikelneit said in Remove Parts of a String:
Does this just "create" the string while compiling so it hasnt to be created in the runtime anymore?
-
Thank you very mutch.