Locates a value in an SRP List.

Syntax

Index = SRP_List_Locate(Handle, Target)

Returns

The index of the first element that matches the target value.

Parameters

ParameterDescription
HandleHandle to an existing SRP List (REQUIRED)
TargetThe value to locate in the SRP List (REQUIRED)

Remarks

The SRP_List_Locate method finds the first element that matches the given target and returns its index. If no match is found, SRP_List_Locate returns zero. This method is extremely fast because the SRP List is indexed! Instant locates makes your huge routine searching a huge list lightning fast!

IMPORTANT: You should always release the handle to an SRP List when you no longer need it by calling SRP_List_Release.

Examples

// Create the list
Handle = SRP_List_Create("ABC,DEF,EFG", ",")

// Look for 'DEF', which will return '2'
Index = SRP_List_Locate(Handle, "DEF")

// Look for 'XYZ', which will return '0'
Index = SRP_List_Locate(Handle, "XYZ")

// Play nice with memory
SRP_List_Release(Handle)
  • No labels