ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / String functions
  • 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).
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: wd290vm.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help