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 Locate service finds the first element that matches the given target and returns its index. If no match is found, it returns zero. This method is extremely fast because the SRP List is indexed! Instant locates makes searching a huge list lightning fast! Note that Locate is case sensitive. If you want to search in a case insensitive manner, use the Match service.

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