Delphi6 function Encyclopedia (1)

Source: Internet
Author: User
Tags integer reference stringreplace

Delphi6 function Daquan 1-strutils.pas

Header function Ansiresemblestext (const atext, aother:string): Boolean; $[strutils.pas
Feature returns whether two strings are similar
Description ANSI (American National Standards Institute) American State Standards Association; case-insensitive
reference function Strutils.soundexproc; var Strutils.ansiresemblesproc
Example checkbox1.checked: = Ansiresemblestext (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansicontainstext (const atext, asubtext:string): Boolean; $[strutils.pas
Feature returns whether the string Atext contains substrings Asubtext
Description is case insensitive
reference function Strutils.ansiuppercase; function Strutils.ansipos
Example checkbox1.checked: = Ansicontainstext (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansistartstext (const asubtext, atext:string): Boolean; $[strutils.pas
function returns whether the string Atext begins with a substring asubtext
Description is case insensitive
Reference function windows.comparestring
Example checkbox1.checked: = Ansistartstext (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansiendstext (const asubtext, atext:string): Boolean; $[strutils.pas
function returns whether the string Atext ends with substrings asubtext
Description is case insensitive
Reference function windows.comparestring
Example checkbox1.checked: = Ansiendstext (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansireplacetext (const atext, Afromtext, atotext:string): string; $[strutils.pas
function returns the result of string atext with substring Afromtext atotext
Description is case insensitive
reference function Sysutils.stringreplace; Type Sysutils.treplaceflags
Example Edit4.text: = Ansireplacetext (Edit1.text, Edit2.text, Edit3.text);
━━━━━━━━━━━━━━━━━━━━━

Header function Ansimatchtext (const atext:string; const Avalues:array of string): Boolean; $[strutils.pas
Feature returns whether the string array avalues contains a string atext
Description is case insensitive
Reference function Strutils.ansiindextext
Example checkbox1.checked: = Ansimatchtext (Edit1.text, [' A1 ', ' A2 ', ' A3 ', ' A4 ']);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansiindextext (const atext:string; const Avalues:array of string): Integer; $[strutils.pas
function returns the position of the string atext in the string array avalues
Description is case-insensitive and returns 1 if not included
Reference function Sysutils.ansisametext
Example Spinedit1.value: = Ansiindextext (Edit1.text, [' A1 ', ' A2 ', ' A3 ', ' A4 ']);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansicontainsstr (const atext, asubtext:string): Boolean; $[strutils.pas
Feature returns whether the string Atext contains substrings Asubtext
Description Case Sensitive
Reference function Strutils.ansipos
Example checkbox1.checked: = Ansicontainsstr (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansistartsstr (const asubtext, atext:string): Boolean; $[strutils.pas
function returns whether the string Atext begins with a substring asubtext
Description Case Sensitive
Reference function Sysutils.ansisamestr
Example checkbox1.checked: = Ansistartsstr (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansiendsstr (const asubtext, atext:string): Boolean; $[strutils.pas
function returns whether the string Atext ends with substrings asubtext
Description Case Sensitive
Reference function Sysutils.ansisamestr
Example checkbox1.checked: = Ansiendsstr (Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━

Header function Ansireplacestr (const atext, Afromtext, atotext:string): string; $[strutils.pas
function returns the result of string atext with substring Afromtext atotext
Description Case Sensitive
reference function Sysutils.stringreplace; Type Sysutils.treplaceflags
Example Edit4.text: = Ansireplacestr (Edit1.text, Edit2.text, Edit3.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansimatchstr (const atext:string; const Avalues:array of string): Boolean; $[strutils.pas
Feature returns whether the string array avalues contains a string atext
Description Case Sensitive
Reference function Strutils.ansiindexstr
Example checkbox1.checked: = Ansimatchstr (Edit1.text, [' A1 ', ' A2 ', ' A3 ', ' A4 ']);
━━━━━━━━━━━━━━━━━━━━━
Header function Ansiindexstr (const atext:string; const Avalues:array of string): Integer; $[strutils.pas
function returns the position of the string atext in the string array avalues
Description Case Sensitive
Reference function Sysutils.ansisamestr
Example Spinedit1.value: = Ansiindexstr (Edit1.text, [' A1 ', ' A2 ', ' A3 ', ' A4 ']);
━━━━━━━━━━━━━━━━━━━━━
First function dupestring (const atext:string; Acount:integer): string; $[strutils.pas
Feature returns a acount copy of the string atext
Description when Acount returns ' at 0 o'clock '
Reference function System.setlength
Example Edit3.text: = Dupestring (Edit1.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
Header function reversestring (const atext:string): string; $[strutils.pas
function returns the reverse sequence of a string atext
Description reversestring (' 1234 ') = ' 4321 '
Reference function System.setlength
Example Edit3.text: = ReverseString (Edit1.text);
━━━━━━━━━━━━━━━━━━━━━

First function stuffstring (const atext:string; Astart, alength:cardinal; Const asubtext:string): string; $[strutils.pas
Feature returns nested strings
Description Astart: nesting start position; Alength: nesting length; Stuffstring (' ABCD ', 2, 0, ' a ') = ' A12BCD '
Reference function System.copy
Example Edit3.text: = Stuffstring (Edit1.text, Spinedit1.value, Spinedit2.value, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Randomfrom (const Avalues:array of string): string; overload; $[strutils.pas
function randomly returns an element in the avalues of an array of strings
Note Before Randomize recommended execution
Reference function System.Random
Example Randomize; Edit3.text: = Randomfrom ([' A1 ', ' A2 ', ' A3 ', ' A4 ']);
━━━━━━━━━━━━━━━━━━━━━
First function ifthen (avalue:boolean; const atrue:string; afalse:string = '): string; overload; $[strutils.pas
function returns the specified logical string
Description Ifthen (True, ' yes ', ' no ') = ' yes '; Ifthen (False, ' yes ', ' no ') = ' no '
Reference
Example Edit3.text: = Ifthen (checkbox1.checked, Edit1.text, Edit2.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Leftstr (const atext:string; const Acount:integer): string; $[strutils.pas
Feature returns the Acount character on the left of the string atext
Description Leftstr (' 123456 ', 3) = ' 123 '
Reference function System.copy
Example Edit3.text: = Leftstr (Edit1.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Rightstr (const atext:string; const Acount:integer): string; $[strutils.pas
function returns the acount character to the right of the string atext
Description Rightstr (' 123456 ', 3) = ' 456 '
Reference function System.copy
Example Edit3.text: = Rightstr (Edit1.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━

Header function Midstr (const atext:string; const Astart, Acount:integer): string; $[strutils.pas
Feature returns string Atext acount characters starting from Astart
It's actually copy.
Reference function System.copy
Example Edit3.text: = Midstr (Edit1.text, Spinedit1.value, Spinedit2.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Searchbuf (Buf:pchar; Buflen:integer; SelStart, Sellength:integer; searchstring:string; Options:tstringsearchoptions = [Sodown]): Pchar; $[strutils.pas
function returns the first location of the pointer to a search
This function is often used to search strings in text
Reference
Example
Begin Searchbuf
function Searchedit (editcontrol:tcustomedit; const searchstring:string;
Searchoptions:tstringsearchoptions; Findfirst:boolean = False): Boolean;
Var
Buffer, P:pchar;
Size:word;
Begin
Result: = False;
if (Length (searchstring) = 0) then Exit;
Size: = Editcontrol.gettextlen;
if (Size = 0) then Exit;
Buffer: = Stralloc (Size + 1);
Try
Editcontrol.gettextbuf (Buffer, Size + 1);
P: = Searchbuf (Buffer, Size, Editcontrol.selstart, Editcontrol.sellength,
SearchString, searchoptions);
If P <> Nil then BEGIN
Editcontrol.selstart: = P-buffer;
Editcontrol.sellength: = Length (searchstring);
Result: = True;
End
Finally
Strdispose (Buffer);
End
End

Procedure Tform1.button1click (Sender:tobject);
Var
Searchoptions:tstringsearchoptions;
Begin
SearchOptions: = [];
If Checkbox1.checked Then
Include (searchoptions, Sodown);
If Checkbox2.checked Then
Include (searchoptions, somatchcase);
If Checkbox3.checked Then
Include (searchoptions, Sowholeword);
Searchedit (Memo1, Edit1.text, searchoptions);
Memo1.setfocus;
End
End Searchbuf
━━━━━━━━━━━━━━━━━━━━━

First function Soundex (const atext:string; Alength:tsoundexlength = 4): string; $[strutils.pas
function return probe string
The description can find the Soundex string according to the detection method (http://www.nara.gov/genealogy/coding.html).
Reference
Example Edit2.text: = Soundex (Edit1.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
First function soundexint (const atext:string; Alength:tsoundexintlength = 4): Integer; $[strutils.pas
function returns probe integer
The larger the value of the alength, the higher the decoding accuracy rate
Reference
Example Spinedit2.value: = Soundexint (Edit1.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Decodesoundexint (avalue:integer): string; $[strutils.pas
function returns the decoding of the probe integer
Description Decodesoundexint (soundexint (' Hello ')) is equivalent to Soundex (' Hello ')
Reference
Example Edit2.text: = Decodesoundexint (Spinedit2.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Soundexword (const atext:string): Word; $[strutils.pas
function returns probe literal values
Indicates no parameter alength has been fixed to 4
Reference
Example Spinedit2.value: = Soundexword (Edit1.text);
━━━━━━━━━━━━━━━━━━━━━
Header function Decodesoundexword (Avalue:word): string; $[strutils.pas
function returns the decoding of the value of the probe literal
Description Decodesoundexword (Soundexword (' Hello ')) is equivalent to Soundex (' Hello ')
Reference
Example Edit2.text: = Decodesoundexword (Spinedit2.value);
━━━━━━━━━━━━━━━━━━━━━

First function soundexsimilar (const atext, aother:string; Alength:tsoundexlength = 4): Boolean; $[strutils.pas
Feature returns whether the probe string of two strings is the same
Description Result: = Soundex (Atext, alength) = Soundex (Aother, Alength)
Reference
Example checkbox1.checked: = Soundexsimilar (Edit1.text, Edit2.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
First function Soundexcompare (const atext, aother:string; Alength:tsoundexlength = 4): Integer; $[strutils.pas
function returns the result of a probe string that compares two strings
Description Result: = Ansicomparestr (Soundex (Atext, Alength), Soundex (Aother, Alength))
Reference function Sysutils.ansicomparestr
Example Spinedit2.value: = Soundexcompare (Edit1.text, Edit2.text, Spinedit1.value);
━━━━━━━━━━━━━━━━━━━━━
Header function Soundexproc (const atext, aother:string): Boolean; $[strutils.pas
Feature call Soundexsimilar returns whether the probe string of two strings is the same
Describes the default values for system variable Ansiresemblesproc
Reference function Strutils.ansiresemblestext
example [var ansiresemblesproc:tcomparetextproc = Soundexproc;]

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.