PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Strings, Buffer and UNICODE
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
CommonLength (Function)
In french: TailleCommune
Returns the number of common characters between two strings (from the beginning or from the end of the string).
Versions 15 and later
Android This function is now available for Android applications.
Java This function is now available for Java applications.
New in version 15
Android This function is now available for Android applications.
Java This function is now available for Java applications.
Android This function is now available for Android applications.
Java This function is now available for Java applications.
Versions 17 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android widget mode.
New in version 18
Android Widget This function is now available in Android widget mode.
Android Widget This function is now available in Android widget mode.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Versions 25 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 25
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
Example
// Compare from the beginning
CommonLength("ABCDE", "ABXYZ")            // returns 2
// Compare from the end
CommonLength("VWXYZ", "ABXYZ", FromEnd) // returns 3
 
// Compare character by character
CommonLength("New York", "New Yorker")  // returns 8
// Compare by entire word
CommonLength("New York", "New York City", WholeWord)  // returns 8
 
// Compare while taking the case into account
CommonLength("ABCDE", "ABCdE")            // returns 3
// Compare while ignoring the case
CommonLength("ABCDE", "ABCdE", IgnoreCase) // returns 5
Syntax
<Result> = CommonLength(<String1> , <String2> [, <Options>])
<Result>: Integer
Length of the common characters between the strings.
<String1>: Character string
String to compare.
<String2>: Character string
String to compare.
<Options>: Optional integer constant
Indicates the comparison options:
FromBeginningCompares from the beginning of the strings
FromEndCompares from the end of the strings
IgnoreCaseCompares while ignoring the case
WholeWordCompares whole words

These constants can be combined.
By default, the comparison is performed from the beginning of the string, character by character, by taking the case into account.
Remarks

Strings, Buffer and UNICODE

CommonLength can be used on buffers, strings and UNICODE strings.
Caution: The IgnoreCase and WholeWord constants do not apply to buffers.
You have the ability to use ANSI strings, Unicode strings and buffers in the different parameters of the function.
The following conversion rule is used for the Ansi systems (Windows or Linux):
  • If at least one of the strings is a buffer, all the strings are converted to buffers and the operation is performed with buffers.
  • If the first condition is not met and there is at least one Unicode string, all the strings are converted to Unicode and the operation is performed in Unicode (the conversion is performed with the current character set, if necessary).
  • Otherwise, the operation is performed in Ansi.
The conversion rule used for Unicode systems is as follows:
  • If at least one of the strings is a buffer, all the strings are converted to buffers and the operation is performed with buffers.
  • Otherwise, the operation is performed in Unicode.
For more details on UNICODE, see Managing UNICODE.
Reminder: The linguistic parameters used are defined during the call to ChangeCharset.
Business / UI classification: Neutral code
Component: wd270vm.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment