You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Finds the first element to match a given string.

Syntax

SRP_FastArray("Match", Handle, StringToMatch, FieldPos, ValuePos, SubValuePos, Option)

Parameters

ParameterDescription
HandleHandle to an existing SRP Fast Array (REQUIRED)
StringToMatchThe string containing the text you are trying to find.
FieldPosThe field position, if found, of the match.
ValuePosThe value position, if found, of the match.
SubValuePosThe sub-value position, if found, of the match.
OptionsIf "MatchAnywhere", the match can occur anywhere in an element. If "MatchAll", only exact matches count.

Remarks

The Match service locates an element within the list that matches the given string. The match is not case sensitive, but if the Option parameter is "MatchAll" (which is the default), then a match succeeds only when the string matches the entire element. If the Option parameter is set to "MatchAnywhere", then the first element contain the given string anywhere within itself is a match. For example, "Branded" is considered a match for "AND" because "and" appears within the element. When a match is found, the FieldPos, ValuePos, and SubValuePos parameters are set to the position of the match. If no match is found, all three parameters will be set to 0.

Examples

// Create a fast array
Handle = SRP_FastArray("Create", "Apple":@FM:"Banana":@FM:"Carrot")

// Find banana (MatchAll is the default)
SRP_FastArray("Match", Handle, "banana", FieldPos, ValuePos, SubValuePos)

// Result: FieldPos = 2, ValuePos = 1, SubValuePos = 1
 
// Find Doughnut
SRP_FastArray("Match", Handle, "doughnut", FieldPos, ValuePos, SubValuePos, "MatchAll")

// Result: FieldPos = 0, ValuePos = 0, SubValuePos = 0
 
// Find App anywhere
SRP_FastArray("Match", Handle, "app", FieldPos, ValuePos, SubValuePos, "MatchAnywhere")

// Result: FieldPos = 1, ValuePos = 1, SubValuePos = 1

// All done
Variable = SRP_FastArray("Release", Handle)
  • No labels