PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Strings, Buffer and UNICODE
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
CommonLength (Function)
In French: TailleCommune
Returns the number of characters common to two characters strings (from the beginning or from the end).
Versions 15 and later
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
New in version 15
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps 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.
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 3

// 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 part common to the two strings.
<String1>: Character string
String to compare.
<String2>: Character string
String to compare.
<Options>: Optional integer constant
Indicates the options for comparison:
FromBeginningCompare from the beginning of the strings
FromEndCompare from the end of the strings
WholeWordCompare by entire word
IgnoreCaseCompare while ignoring the case
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 applies to the buffers, the strings and the 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):
  • It at least one of the strings is a buffer, all the strings are converted into buffers and the operation is performed with buffers,
  • otherwise, if at least one of the strings is in Unicode format, all the strings are converted into Unicode and the operation is performed in Unicode,
  • otherwise, the operation is performed in Ansi format.
The following conversion rule is used for the Unicode systems (Windows CE):
  • It at least one of the strings is a buffer, all the strings are converted into buffers and the operation is performed with buffers,
  • otherwise, the operation is performed in Unicode.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 11
This page is also available for…
Comments
Click [Add] to post a comment