RAD Studio
ContentsIndex
PreviousUpNext
Commonly Used Long String Routines

The long string handling routines cover several functional areas. Within these areas, some are used for the same purpose, the differences being whether they use a particular criterion in their calculations. The following tables list these routines by these functional areas:

  • Comparison
  • Case conversion
  • Modification
  • Sub-string
Where appropriate, the tables also provide columns indicating whether a routine satisfies the following criteria.
  • Uses case sensitivity: If locale settings are used, it determines the definition of case. If the routine does not use locale settings, analyses are based upon the ordinal values of the characters. If the routine is case-insensitive, there is a logical merging of upper and lower case characters that is determined by a predefined pattern.
  • Uses locale settings: Locale settings allow you to customize your application for specific locales, in particular, for Asian language environments. Most locale settings consider lowercase characters to be less than the corresponding uppercase characters. This is in contrast to ASCII order, in which lowercase characters are greater than uppercase characters. Routines that use the system locale are typically prefaced with Ansi (that is, AnsiXXX).
  • Supports the multi-byte character set (MBCS): MBCSs are used when writing code for far eastern locales. Multi-byte characters are represented by one or more character codes, so the length in bytes does not necessarily correspond to the length of the string. The routines that support MBCS parse one- and multibyte characters.
ByteType and StrByteType determine whether a particular byte is the lead byte of a multibyte character. Be careful when using multibyte characters not to truncate a string by cutting a character in half. Do not pass characters as a parameter to a function or procedure, since the size of a character cannot be predetermined. Pass, instead, a pointer to a to a character or string. For more information about MBCS, see Enabling Application Code

String comparison routines:

Routine 
Case-sensitive 
Uses locale settings 
Supports MBCS 
AnsiCompareStr  
yes  
yes  
yes  
AnsiCompareText  
no  
yes  
yes  
AnsiCompareFileName  
no  
yes  
yes  
AnsiMatchStr  
yes  
yes  
yes  
AnsiMatchText  
no  
yes  
yes  
AnsiContainsStr  
yes  
yes  
yes  
AnsiContainsText  
no  
yes  
yes  
AnsiStartsStr  
yes  
yes  
yes  
AnsiStartsText  
no  
yes  
yes  
AnsiEndsStr  
yes  
yes  
yes  
AnsiEndsText  
no  
yes  
yes  
AnsiIndexStr  
yes  
yes  
yes  
AnsiIndexText  
no  
yes  
yes  
CompareStr  
yes  
no  
no  
CompareText  
no  
no  
no  
AnsiResemblesText  
no  
no  
no  

Case conversion routines:

Routine 
Uses locale settings 
Supports MBCS 
AnsiLowerCase  
yes  
yes  
AnsiLowerCaseFileName  
yes  
yes  
AnsiUpperCaseFileName  
yes  
yes  
AnsiUpperCase  
yes  
yes  
LowerCase  
no  
no  
UpperCase  
no  
no  

Note: The routines used for string file names: AnsiCompareFileName, AnsiLowerCaseFileName, and AnsiUpperCaseFileName all use the system locale. You should always use file names that are portable because the locale (character set) used for file names can and might differ from the default user interface.
String modification routines:

Routine 
Case-sensitive 
Supports MBCS 
AdjustLineBreaks  
NA  
yes  
AnsiQuotedStr  
NA  
yes  
AnsiReplaceStr  
yes  
yes  
AnsiReplaceText  
no  
yes  
StringReplace  
optional by flag  
yes  
ReverseString  
NA  
no  
StuffString  
NA  
no  
Trim  
NA  
yes  
TrimLeft  
NA  
yes  
TrimRight  
NA  
yes  
WrapText  
NA  
yes  

Sub-string routines:

Routine 
Case-sensitive 
Supports MBCS 
AnsiExtractQuotedStr  
NA  
yes  
AnsiPos  
yes  
yes  
IsDelimiter  
yes  
yes  
IsPathDelimiter  
yes  
yes  
LastDelimiter  
yes  
yes  
LeftStr  
NA  
no  
RightStr  
NA  
no  
MidStr  
NA  
no  
QuotedStr  
no  
no  
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!