Page History
SRP Fast Arrays are an alternative replacement to BASIC+ dynamic arrays and can greatly enhance performance for large processes. SRP_FastArray provides the following services:
Method | Description | Added |
---|---|---|
Clear | Removes all values from an SRP Fast Array. | 2.1.10 |
Count | Counts the number of fields, values, or subvalues in an SRP Fast Array. | |
Create | Creates a new SRP Fast Array. | |
Delete | Performs a DELETE on an SRP Fast Array. | |
Extract | Performs an EXTRACT on an SRP Fast Array. | |
GetVariable | Converts an SRP Fast Array back into a BASIC+ dynamic array. | |
Insert | Performs an INSERT on an SRP Fast Array. | |
InsertFromList | Inserts an SRP List into an SRP Fast Array. | |
Match | Finds the first element to match a given string. | |
Reduce | Creates a new fast array containing only those elements that match the given string. | |
Release | Releases the handle to an SRP Fast Array. | |
Replace | Performs a REPLACE on an SRP Fast Array. | |
ReplaceWithList | Replaces an element in an SRP Fast Array with an SRP List. |
...
SRP_FastArray does not have built in searchinga Locate service, but SRP List does. Thankfully, SRP Lists can be created instantaneously from SRP Fast Arrays using a special method. So, we can do a locate at blinding speeds after all:it does have the Match and Reduce services. The Match service looks for an element that matches (in part or in total) a given string and gives you the position of the first match. The Reduce service finds all elements that match a string and return a reduced array containing only those elements.
Code Block |
---|
Pos |
Code Block |
ListHandle = SRP_List_CreateFromFastArray(ArrayHandleFastArray("Match", Handle, 2Target, 10) Pos = SRP_List_Locate(ListHandle, Target) SRP_List_Release(ListHandleFieldPos, ValuePos, SubValuePos, "MatchAll") |
Inserting SRP Lists
SRP Fast Arrays play nicely with SRP Lists. In addition to using Insert and Replace on single values, you can also insert SRP whole SRP Lists or replace elements with whole SRP Lists. Since SRP Lists have no delimiter recognitions at all, they will behave as though they are delimited one level lower than the insert level. So, if you insert an SRP List into a field position, the SRP List will behave as though it is value-mark delimited.
...