Character arrangement and combination Delphi

Source: Internet
Author: User
/// <Summary> /// whether the string exists in "any digit consisting of specified numbers in ascending order" /// eg: /// aset = 178 can be composed of any digit in ascending order: 1, 7, 8, 17, 18, 78, 178 // If Aval is one of them, true is returned, otherwise, false is returned /// </Summary> /// <Param name = "Aval"> value with judgment </param> /// <Param name = "aset"> ascending numeric string </param> function check_isallinascnumbersetbyanybit (const Aval, aset: string): Boolean; function combin (mstrings: tstrings; mstr: string; mlen: integer): Boolean; Procedure fcombin (msubstr: string; mpath: string); var I: integer; s: string; B: Boolean; lst: tstringlist; begin if length (mpath)> = mlen then begin lst: = tstringlist. create; for I: = 1 to length (mpath) Do begin lst. add (mpath [I]); end; lst. sort; B: = true; for I: = 0 to lst. count-1 do begin if lst [I] <> mpath [I + 1] Then begin B: = false; break; end; lst. free; if B then mstrings. add (mpath); End else for I: = 1 to length (msubstr) Do begin S: = msubstr; Delete (S, I, 1); fcombin (S, mpath + msubstr [I]); end; begin result: = false; if not assigned (mstrings) Then exit; mstrings. beginupdate; try mstrings. clear; fcombin (mstr, ''); finally mstrings. endupdate; end; Result: = true; end; var I: integer; lst: tstringlist; begin result: = false; lst: = tstringlist. create; try combin (LST, aset, length (Aval); for I: = 0 to lst. count-1 do begin if Aval = lst [I] Then begin result: = true; exit; end; finally lst. free; end; Procedure tform1.btn1click (Sender: tobject); begin if check_isallinascnumbersetbyanybit (edt1.text, '20140901') Then caption: = 'OK' else caption '; end;

Character arrangement and combination Delphi

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.