⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qstrings.pas

📁 a voice guide client ,it is the second part of voice guide center
💻 PAS
字号:
unit QStrings;

interface

type
  TCharSet = set of Char;

{ Characters by default used as separators of words.}

const
  Q_StdDelimsSet = [#0..#32,'!','"','(',')','*','+',',','-','.','/',':', 
     ';','<','=','>','?','[','\',']','^','{','}','|']; 

{ Function for matching strings.}

{ Q_CompStr compares two strings to case sensitivity. Reset result
  It is less than zero, if S1 < S2; it is more than zero, if S1 > S2, and is equal to zero, if
  S1 = S2. This function ceases matching, when the discrepancy of strings is revealed
  Or when the character with the code 0 is detected. If this character can meet in
  To middle of string, use instead of Q_CompStr the function Q_CompStrL. Second
  The function Q_PCompStr is similar Q_CompStr for PChar and Pointer (String). If
  It is necessary to clarify only, two strings are equal or are not equal, take advantage
  Instead of Q_CompStr by the function Q_SameStr.}

function Q_CompStr (const S1, S2: string): Integer;
function Q_PCompStr (P1, P2: PChar): Integer;

{ Q_CompStrL compares two strings on MaxL to the first characters to case sensitivity.
  The reset result is less than zero, if Copy (S1,1, MaxL) < Copy (S2,1, MaxL);
  The result is more than zero, if Copy (S1,1, MaxL) > Copy (S2,1, MaxL), differently
  The result is equal to zero (if Copy (S1,1, MaxL) = Copy (S2,1, MaxL)). If to you
  It is necessary to clarify only, two strings are equal or are not equal, take advantage
  Instead of Q_CompStrL by the function Q_SameStrL.}

function Q_CompStrL (const S1, S2: string; MaxL: Cardinal = MaxInt): Integer;

{ Q_CompText compares two strings without case sensitivity. Reset result
  It is less than zero, if S1 < S2; it is more than zero, if S1 > S2, and is equal to zero, if
  S1 = S2. This function ceases matching, when the discrepancy of strings is revealed
  Or when the character with the code 0 is detected. If this character can meet in
  To middle of string, use instead of Q_CompText the function Q_CompTextL. Second
  The function Q_PCompText is similar Q_CompText for PChar and Pointer (String). If
  It is necessary to clarify only, whether two strings whether or not are equal, take advantage
  Instead of Q_CompText by the function Q_SameText.}

function Q_CompText (const S1, S2: string): Integer;
function Q_PCompText (P1, P2: PChar): Integer;

{ Q_CompTextL compares two strings on MaxL to the first characters without case sensitivity.
  If the fragment of the first string is more (in alphabetic order), than fragment
  The second string the reset value is more than zero. If a fragment of the first string
  It is less, than the fragment of the second string reset value is less than zero, differently
  The result is equal to zero. If it is necessary to clarify only, whether two strings are equal
  Or are not equal, use instead of Q_CompTextL the function Q_SameTextL.}

function Q_CompTextL (const S1, S2: string; MaxL: Cardinal = MaxInt): Integer;

{ Q_SameStr compares two strings to case sensitivity and resets True, if
  The strings are equal, differently resets False. The function Q_PSameStr is similar Q_SameStr
  For Pointer (String).}

function Q_SameStr (const S1, S2: string): Boolean;
function Q_PSameStr (P1, P2: Pointer): Boolean;

{ Q_SameStrL compares two strings on MaxL to the first characters to case sensitivity.
  Resets True, if the strings are equal, differently resets False.}

function Q_SameStrL (const S1, S2: string; MaxL: Cardinal): Boolean;

{ Q_SameText compares two strings without case sensitivity and resets True, if
  The strings are equal, differently - False. Function Q_PSameText is similar Q_SameStr for
  Pointer (String).}

function Q_SameText (const S1, S2: string): Boolean;
function Q_PSameText (P1, P2: Pointer): Boolean;

{ Q_SameTextL compares two strings on MaxL to the first characters without case sensitivity.
  Resets True, if the strings are equal, differently resets False.}

function Q_SameTextL (const S1, S2: string; MaxL: Cardinal): Boolean;

{ Q_MatchStr checks, whether has a place log-on of a substring SubStr in string S,
  Since the character S [Pos]. At matching the register of characters is taken into account. If
  The log-on takes place, the function resets True, differently - False. This function
  Realizes by itself fast variant of check Q_SameStr (X, Copy (S, Pos, Length (X))).
  As against other similar functions, substring of zero length enters in
  Any string. The idea of this function is borrowed from the unit cStrings.pas, writer
  Which is David Butler (david@e.co.za). }

function Q_MatchStr (const SubStr, S: string; Pos: Integer = 1): Boolean;

{ Q_MatchText checks, whether has a place log-on of a substring SubStr in string S,
  Since the character S [Pos]. At matching the register of characters is not taken into account. If
  The log-on takes place, the function resets True, differently - False. This function
  Realizes by itself fast variant of check Q_SameText (X, Copy (S, Pos, Length (X))).
  As against other similar functions, substring of zero length enters in
  Any string. The idea of this function is borrowed from the unit cStrings.pas, writer
  Which is David Butler (david@e.co.za). }

function Q_MatchText (const SubStr, S: string; Pos: Integer = 1): Boolean;

{ Q_TestByMask checks, whether the string S to a mask Mask satisfies, reputing,
  That the characters MaskChar from string Mask can be substituted in string S by anyone
  By other characters. At matching the register of characters is considered.
  If the string S satisfies to a mask, the function resets True, differently False.
  For example, Q_TestMask('ISBN 5-09-007017-2','ISBN ?-??-??????-?','?') will return
  Value True. }

function Q_TestByMask (const S, Mask: string; MaskChar: Char = 'X'): Boolean;

{ Q_TestWildStr checks, whether the string S to a mask Mask satisfies, reputing,
  That the characters MaskChar from string Mask can be substituted in string S by anyone
  By other characters, and the characters WildCard can be substituted by any quantity
  Other characters. At matching the large and small characters differ. The character
  WildCard should be distinct from #0. If the string S satisfies to a mask,
  The function resets True, differently False. For example, following function call
  Will return True: Q_TestWildStr('abc12345_infQ_XL.dat','abc*_???Q_*.d*at'). }

function Q_TestWildStr (const S, Mask: string; MaskChar: Char = '?';
  WildCard: Char = '*'): Boolean;

{ Q_TestWildText is similar to the function Q_TestWildStr, but register of characters
  Is not considered (large and small characters do not differ).}

function Q_TestWildText (const S, Mask: string; MaskChar: Char = '?';
  WildCard: Char = '*'): Boolean;


{ Function for change of the register of characters.}

{ Q_CharUpper translates the character Ch in the upper case (in the large character).}

function Q_CharUpper (Ch: Char): Char;

{ Q_CharLower translates the character Ch in lowercase (in the small character).}

function Q_CharLower (Ch: Char): Char;

{ Q_StrUpper translates string S in the upper case (in the large characters). At
  It the initial string varies. The function Q_PStrUpper is similar to the procedure
  Q_StrUpper For PChar and Pointer (String), except that she(it)
  In addition resets the pointer by the beginning of string.}

procedure Q_StrUpper (var S: string);
function Q_PStrUpper (P: PChar): PChar;

{ Q_StrLower translates string S in lowercase (in small characters). At
  It the initial string varies. The function Q_PStrLower is similar to the procedure
  Q_StrLower For PChar and Pointer (String), except that she(it)
  In addition resets the pointer by the beginning of string.}

procedure Q_StrLower (var S: string);
function Q_PStrLower (P: PChar): PChar;

{ Q_StrUpperMoveL copies contents of string Source in string Dest. Thus
  The characters are translated in the upper case. Maximum number copied
  Characters is equal MaxL. Length of string Dest is installed equal to number
  The copied characters. The memory for string Dest should be distributed
  Beforehand by function call SetString (or SetLength) (size
  Not less MaxL of characters).}

procedure Q_StrUpperMoveL (const Source: string; var Dest: string; MaxL: Cardinal);

{ Q_StrLowerMoveL copies contents of string Source in string Dest. Thus
  The characters are translated in lowercase. Maximum number copied
  Characters is equal MaxL. Length of string Dest is installed equal to number
  The copied characters. The memory for string Dest should be distributed
  Previously by function call SetString (or SetLength) (size
  Not less MaxL of characters).}

procedure Q_StrLowerMoveL (const Source: string; var Dest: string; MaxL: Cardinal);

{ Q_UpperCase translates string S in the upper case (in the large characters). Initial
  The string thus does not vary. This function works more slowly, than Q_StrUpper
  Or Q_StrUpperMoveL.}

function Q_UpperCase (const S: string): string;

{ Q_LowerCase translates string S in lowercase (in small characters). Initial
  The string thus does not vary. This function works more slowly, than Q_StrLower
  Or Q_StrLowerMoveL.}

function Q_LowerCase (const S: string): string;

{ Q_UpLowerInPlace will convert the first character of string to the upper case, and all
  Other characters - to lowercase. The initial string varies.}

procedure Q_UpLowerInPlace (var S: string);

{ Q_UpLowerStr will convert the first character of string to the upper case, and all
  Other characters - to lowercase. The initial string does not vary.
  For example: 'r坌a犭世 bsDSFc' - > 'R

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -