Skip to content

Find_Element - Set

Returns the index of an element in a set or -1 if not found

Type: Function
Return Data Type: Integer

Parameters

Parameter Type Description
ElemStr String Element value to be found in the set

Syntax

Function Find_Element String ElemStr Returns Integer

Call Example

Get Find_Element ElemStr to IntegerVariable

Description

Find_Element returns the index of an element whose value matches ElemStr. If no element matches, it returns -1. Like its superclass, the index numbers start at zero.

// Search for a set value and, if found, replace it with a new value 
Procedure ReplaceElement string sOldElement string sNewElement
    integer iPos
    get Find_Element of oSet sOldElement to iPos
    If (iPos<>-1) Begin
        Set Value of oSet iPos to sNewElement
    End
End_Procedure

See Also

Add_Element | Remove_Element | Value

Return Value

Returns the index of the element whose value matches ElemStr. If no element matches, returns -1.