How to query a RichEdit and put the query results in another RichEdit, Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiBase/html/delphi_20061209085300216.html
There are two RichEdit controls. the received data is displayed in richedit1, and each data is separated by a carriage return. You need to query richedit1 and display the query results in richedit2, I want to know how to use it.
The query conditions are not clearly stated in the question. How can I write a query for you? What are the results?
Do not "understand yourself", or "Ask questions ".
---- It may be sharp and acceptable.
For example, the ricdedit1 control has
001 name: Zhang San age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)
002 name: Li Si age: 21 Gender: Female remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)
003 name: Wang Wu age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)
///////////////
To implement a query, for example, querying "male", the query result is displayed in richedit2. The display format is as follows:
//////////////
001 name: Zhang San age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)
003 name: Wang Wu age: 20 Gender: male remarks: SOA practice full strategy hiring Web Front-end development engineers 07 years employment class, catch up with the prime time in the workplace, hot news! . Net job fair December 10 (Beijing)
procedure tform1.button2click (Sender: tobject);
var
I: integer;
begin
edit1.text: = 'male '; // The reason why 'gender: Male' is used as the query condition is to prevent other locations such as names from having the word 'male'
for I: = 0 to richedit1.lines. count-1 do
If pos ('gender: '+ edit1.text, richedit1.lines [I])> 0 then
richedit2.lines. add (richedit1.lines [I]);
end;
// It seems that RichEdit is not a strong expert in processing such data.
controls such as grid can be used. However, you may have special needs. The Code above can meet your needs. You can modify the value of ('gender: '+ edit1.text) according to different conditions. For example, use checkbox to determine whether the query is by name or gender... to query the name, you can:
var substr: string;
.....
If checkboxxingming. checked then substr: = 'name: '+ edit1.text;
.....
If pos (substr, richedit1.lines [I])> 0 then ......