A
A
AlexSer2020-02-06 13:19:36
Qt
AlexSer, 2020-02-06 13:19:36

How to remove extra characters from a QT C++ string?

I accept data from the com port. This kind of data comes in:

1H|\^&|||ACL9000|||||||P|1|20200206123249
90
2P|1|||||||U||||||||||||||||||||||||||
90
3O|1|3||^^^0013|||||||||||^|||||||||||F||||||
F8
4R|1|^^^0013|29.900|s||||F||||20200206105424|
98
5C|1|I|300^Result out of Normal Range|I
AE
6R|2|^^^0013|2.821|R||||F||||20200206105424|
43
7R|3|^^^0013|2.792|INR||||F||||20200206105424|
E3
0C|1|I|300^Result out of Normal Range|I
A9
1R|4|^^^0013|22.475|%||||F||||20200206105424|
4A
2C|1|I|300^Result out of Normal Range|I
AB
3O|2|3||^^^0202|||||||||||^|||||||||||F||||||
F9
4R|1|^^^0202|10.900|s||||F||||20200206110816|
8F
5C|1|I|300^Result out of Normal Range|I
AE
6R|2|^^^0202|3.621|g/L||||F||||20200206110816|
D3
7P|2|||||||U||||||||||||||||||||||||||
96
0O|1|2||^^^0013|||||||||||^|||||||||||F||||||
F4
1R|1|^^^0013|11.400|s||||F||||20200206105424|
87
2R|2|^^^0013|1.075|R||||F||||20200206105424|
3F
3R|3|^^^0013|1.075|INR||||F||||20200206105424|
D8
4R|4|^^^0013|95.438|%||||F||||20200206105424|
56
5O|2|2||^^^0092|||||||||||^|||||||||||F||||||
01
6R|1|^^^0092|35.300|s||||F||||20200206110136|
94
7R|2|^^^0092|1.107|R||||F||||20200206110136|
43
0O|3|2||^^^0202|||||||||||^|||||||||||F||||||
F6
1R|1|^^^0202|9.700|s||||F||||20200206110816|
62
2R|2|^^^0202|4.283|g/L||||F||||20200206110816|
D4
3P|3|||||||U||||||||||||||||||||||||||
93
4O|1|1||^^^0013|||||||||||^|||||||||||F||||||
F7
5R|1|^^^0013|11.200|s||||F||||20200206105424|
89
6R|2|^^^0013|1.057|R||||F||||20200206105424|
43
7R|3|^^^0013|1.056|INR||||F||||20200206105424|
DB
0R|4|^^^0013|98.909|%||||F||||20200206105424|
58
1L|1|N
04

How to clear a line from characters of the DB type, but it is better to delete the line if the type is DB, i.e. those characters that through time?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Ronald McDonald, 2020-02-06
@AlexSer

"In the forehead" - drive the output into a QStringList and delete those lines whose length is 3.

R
Roman Khudoberdin, 2020-02-12
@kukiman

You can write a parser and regular expressions for it, qt has a QRegExp Class with which you can write a parser.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question