guides:programming:programmers_reference_manual:locate_by

Locate...By statement

Use this version of Locate when you are dealing with sorted data. This statement returns the location where a specified string should be inserted, according to the specified sorting consideration.

The By clause in the BASIC+ Locate…By statement locates the sorted position (index) of a value.

Locate substring In string By seq [Using delim] Setting POS Then Else statements

The Locate…By statement has the following parameters.

ParameterDescription
substringSpecifies the value whose position is to be located in string.
StringDesignates the string that is to be searched.
SeqLocate…By uses seq to determine placement of substring. The By clause must follow the in clause in this general format. The seq parameter may have any of the following values:

Value - Justification
AL - Ascending, Left-justified.
AR - Ascending, Right-justified (numeric).
DL - Descending, Left-justified.
DR - Descending, Right-justified (numeric).
delimSpecifies the character that is to be used in the search for the substring. It may be any ASCII character. If dynamic arrays
are being searched, delim should be a field mark (@FM),
value mark (@VM), or a subvalue mark (@SVM). If a Using clause is not specified, a value mark is assumed.

Do not include a delim character in a string expression.
* This internal subroutine sorts a list.
 

Sort_List:
 

 * LIST is an @FM-delimited list of names.
 transfer list to old
 * find out how many names
 numNames = dcount( old, @fm)
 for i = 1 to numNames
  Locate old<i> in list By "AL" Using @fm Setting pos else
   List = Insert(list, pos, 0, 0, OLD<I>)
  end
 next i


return
  • guides/programming/programmers_reference_manual/locate_by.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1