Creates a new fast array containing only those elements that match the given string.

Syntax

SRP_FastArray_Reduce(Handle, StringToMatch, MatchAnywhereFlag)

Parameters

ParameterDescription
HandleHandle to an existing SRP Fast Array (REQUIRED)
StringToMatchThe string containing the text you are trying to find.
MatchAnywhereFlagIf true, the match can occur anywhere in an element. Otherwise, only exact matches count.

Remarks

The SRP_FastArray_Reduce method builds a new Fast Array containing only element that match the given string. The match is not case sensitive, but if the MatchAnywhereFlag is false (which is the default), then a match succeeds only when the string matches the entire element. If the MatchAnywhereFlag is true, 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. 

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

Examples

// Create a fast array
Handle = SRP_FastArray_Create("Apple Pie":@FM:"Banana Cream Pie":@FM:"Chocolate Cake")

// Return only elements exactly matching "chocolate cake"
SRP_FastArray_Reduce(Handle, "chocolate cake", 0)

// Result: "Chocolate Cake"
 
// Find all elements containing "pie"
SRP_FastArray_Match(Handle, "pie", 1)

// Result: "Apple Pie" :@FM: "Banana Cream Pie"

// All done
Variable = SRP_FastArray_Release(Handle)
  • No labels