Cleans an array by removing blank elements and/or removing duplicates.
NewArray = SRP_Array("Clean", Array, Option, Delim)
Returns
The cleaned array.
Parameters
Parameter | Description |
---|---|
Array | The dynamic array to be cleaned. (REQUIRED) |
Option | Determines the kind of clean operation to perform. (OPTIONAL) |
Delim | The delimiter that separates the elements in the given Array. (OPTIONAL) |
Remarks
Need to tidy up your array? Use the Clean service to quickly remove blanks and duplicates from your dynamic array. Simply pass it your array and its delimiter. You can use the Option parameter to control the cleaning process.
- To remove duplicates in addition to removing blanks, set the Option parameter to "TrimAndMakeUnique".
- To remove only trailing blanks, set the Option parameter to "TrimTrailing". Doing so will leave blanks inside the array and only remove blanks at the end of the array. This is useful for stripping blank data from the end of an array retrieved from an EDITTABLE.
- Omitting the Option parameter or setting it to "Trim" will simply remove all blanks, including trailing blanks.
The Delim paramater can also be omitted, in which case it will assume @FM.
Examples
// Remove blanks Array = "Don":@FM:@FM:@FM:"Don":@FM:@FM:@FM:"Paul":@FM:@FM:@FM:"Frank":@FM:@FM:@FM:"Bob":@FM:@FM:@FM NewArray = SRP_Array("Clean", Array) // NewArray will be "Don":@FM:"Don":@FM:"Paul":@FM:"Frank":@FM:"Bob" // Remove all blanks using custom delimiter Array = "Don~~Don~~Paul~~Frank~~Bob~~" NewArray = SRP_Array("Clean", Array, "Trim", "~") // NewArray will be "Don~Don~Paul~Frank~Bob" // Remove blanks and duplicates Array = "Don~~Don~~Paul~~Frank~~Bob~~" NewArray = SRP_Array("Clean", Array, "TrimAndMakeUnique", "~") // NewArray will be "Don~Paul~Frank~Bob" // Remove only trailing blanks Array = "Don":@FM:@FM:@FM:"Don":@FM:@FM:@FM:"Paul":@FM:@FM:@FM:"Frank":@FM:@FM:@FM:"Bob":@FM:@FM:@FM NewArray = SRP_Array("Clean", Array, "TrimTrailing", @FM) // NewArray will be "Don":@FM:@FM:@FM:"Don":@FM:@FM:@FM:"Paul":@FM:@FM:@FM:"Frank":@FM:@FM:@FM:"Bob"