Delphi String Separator Function Usage Example _delphi

Source: Internet
Author: User

The example of this article describes the use of Delphi string separation functions. Share to everyone for your reference. The implementation methods are as follows:

This instance enables you to separate the string s into several strings based on the representation of the string separator, in the list of Rs strings, as follows:

Copy Code code as follows:
Procedure SeparateTerms2 (s:string; Separator:string;var rs:tstringlist);
Var
astr:string;
Idx:integer;
asubstr:string;
Begin
ASTR: = Trim (s);
While Pos (Separator, ASTR) > 0 Do
Begin
IDX: = Pos (Separator, ASTR);
ASUBSTR: = Copy (AStr, 1, idx-1);
Rs. ADD (ASUBSTR);
ASTR: = Copy (AStr, idx + 1, Length (ASTR));
End
If astr+ ' a ' <> ' a ' then Rs. ADD (ASTR); If the remaining string exists, it is stored in the string list
End

I hope this article will help you with the Delphi program design.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.