ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / String functions
  • Strings, Buffer and Unicode
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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
// Comparaison en partant du début
CommonLength("ABCDE", "ABXYZ")            // renvoie 2
// Comparaison en partant de la fin
CommonLength("VWXYZ", "ABXYZ", FromEnd) // renvoie 3

// Comparaison caractère par caractère
CommonLength("New York", "New Yorker")  // renvoie 8
// Comparaison par mot entier 
CommonLength("New York", "New York City", WholeWord)  // renvoie 8

// Comparaison avec prise en compte de la casse
CommonLength("ABCDE", "ABCdE")            // renvoie 3
// Comparaison sans prise en compte de la casse
CommonLength("ABCDE", "ABCdE", IgnoreCase) // renvoie 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

The function CommonLength FUNCTION function works on buffers, strings and Unicode strings.
Attention: Constants SansCasse and MotComplet are ignored on 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 Unicode management.
Reminder: The language parameters used are defined when the ChangeCharset function is called.
Business / UI classification: Neutral code
Component: wd300vm.dll
Minimum version required
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help