Have you tried to check the strings with a regular expression? See QRegularExpression.
Have you tried to check the strings with a regular expression? See QRegularExpression.
Dear Lykurg,
Thanks for the reply....I have gone through the QRegularExpression but dint find any solution through that so posted in the forums again......Any solution would be appreciable.......
Regards,
Open the QRegularExpression documentation again and instead of looking for a solution there, read the documentation with understanding.
Dear Wysota,
Thanks for the reply........I have read the documentation i have used most of the syntax in my application but not finding the required....Its not that i have only looked for the solution have even read the docs........Any solution would be appreciable......Thanks in Advance........
Regards,
Show us what you have tried to do with those classes rather than just telling us that you have "used most of the syntax in my application" or that you "have even read the docs". We cannot fix or guide based on what we cannot see.
This is how you show us. Copy the following two lines into a reply:
[code]
[/code]
Then, between the two tags, paste your best attempt at coding the function to validate the input and press Submit Reply.
The solution can be had using only the classes pointed out in this thread. I estimate an equivalent of your script routine consists of less than twenty lines. That depends a little on exactly what "strVarInstance" represents because the script code is, well, odd.
Dear Chris,
Thanks for the reply......Please find the below code about how i used one of the syntax for my application.........
Qt Code:
int pos = rxlen.indexIn("Length: 1212AP"); if (pos > -1) { qDebug()<<value<<"The Value is"; qDebug()<<unit<<"The Unit is"; qDebug()<<uts<<"The Uts is";To copy to clipboard, switch view to plain text mode
Thanks in Advance.....Any solution would be appreciable........
Regards,
Your expression reads: one or more digits followed by a 0 or more white spaces followed by a digit or capital letter. There is no cap(3) here. Did you really think this expression would match a string such as "INAP1212"?
Originally Posted by StarRocks
Dear Wysota,
Thanks for the reply......Actually in my code i have commented that line but forgot to do the same in the coding that i have posted........Hope you understood the situation that i have posted.........Any solution would be appreciable.......Thanks in Advance...Actually i am not exactly knowing how to have syntax in that format...
Regards,
Concentrate on getting a regular expression that matches 4 or more digits. Once you have that extend it by forcing the match to only occur at the end of the string and you will be most of the way there. You may find an online regular expression tester a useful tool to help learn in conjunction with the Qt docs.
Dear Wysota,
Thanks for the reply.......Actually i have done the validation something like this.........Just look the code phrased below
Qt Code:
ui->lineEditVehicleNumber->setValidator(validator); qDebug()<<"The Vehicle number is"<<rx;To copy to clipboard, switch view to plain text mode
But actually i am getting the format which i wanted to have numbers at last but im not satisfied with the coding that i have done......Can anyone remodify it......Thanks in Advance......Any solution would be appreciable.
Regards,
Bookmarks