PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • WLanguage comparison procedure
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
SeekByProcedure (Function)
In French: ChercheParProcédure
Seeks an element in a one-dimensional array by using a comparison procedure.
Note: This function is equivalent to ArraySeekByProcedure.
Versions 18 and later
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 18
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Universal Windows 10 App This function is now available in Windows Store apps mode.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 20 and later
Windows Mobile This function is now available for the Windows Mobile applications.
New in version 20
Windows Mobile This function is now available for the Windows Mobile applications.
Windows Mobile This function is now available for the Windows Mobile applications.
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.
WEBDEV - Browser code This function is now available in browser code.
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.
WEBDEV - Browser code This function is now available in browser code.
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.
WEBDEV - Browser code This function is now available in browser code.
Versions 22 and later
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
New in version 22
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Android Widget This function is now available in Android Widget mode.
Android This function is now available for the Android applications.
Java This function is now available for the Java applications.
Example
// Create an array of references
arrReference is array of strings

// Find a reference identified by its first 6 characters
nSubscript is int
nSubscript = SeekByProcedure(arrReference, ProcCompareShortReference, ...
asLinear, 0, "123456")
// ProcCompareShortReference procedure
PROCÉDURE ProcCompareShortReference(Element1, Search)
// Compare the first 6 characters of the array elements
// with the sought reference
RETURN StringCompare(Left(Element1, 6), Search)
Syntax
<Result> = SeekByProcedure(<Array Name> , <Procedure> , <Type of Search> [, <Start Subscript>[, <Sought Value 1> [, ...[, <Sought Value N>]]])
<Result>: Integer
Subscript of element found in the array.
<Array Name>: Array
Name of Array variable where the search will be performed. This array must be a one-dimensional array.
<Procedure>: Character string (with or without quotes)
WLanguage comparison procedure. See remarks for more details.
<Type of Search>: Integer constant
Type of search to perform:
asBinaryBinary search.
This search mode is fast but it must be used on an array sorted in ascending order with the same comparison procedure or with an equivalent procedure (see ArraySort).
asLinearLinear search. The search starts:
  • from the first element if <Start Subscript> is set to 0,
  • from <Start Subscript>.
The search stops as soon as an element is found.
asLinearLastLinear search from the last element. This constant must not be used if <Start Subscript> is specified.
asLinearPreviousLinear search for the previous element. This search is performed from the current position or from <Start Subscript>.
asLinearFirstLinear search from the first element. <Start Subscript> is ignored when this constant is specified.
asLinearNextLinear search for the next element. This search is performed from the current position (if <Start Subscript> is set to 0) or from <Start Subscript>.
<Start Subscript>: Optional integer
Start position for the search (linear search only). This parameter is not required for a binary search.
<Sought Value 1>: Any type
Value of sought element.
<Sought Value N>: Any type
Value of sought element.
Remarks

WLanguage comparison procedure

This procedure is called as many times as necessary.
The first parameter of the procedure corresponds to the array element to compare. The other parameters are the search values passed in parameter to SeekByProcedure.
The comparison procedure must return the following values:
  • If the array element is too small in relation with the search values, the procedure must return -1.
  • If the array element is too large in relation with the search values, the procedure must return 1.
  • If the array element corresponds to the search values, the procedure must return 0.
Caution: for the dichotomous search, the comparison procedure must return the following values:
  • If the array element is too small in relation to the search values, the procedure must return 1.
  • If the array element is too large in relation to the search values, the procedure must return -1.
  • If the array element corresponds to the search values, the procedure must return 0.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment