Cleans an array by removing blank elements and/or removing duplicates.
NewArray = SRP_Array("Clean", Array, Option, Delim) |
The cleaned array.
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) |
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.
The Delim paramater can also be omitted, in which case it will assume @FM.
Note: This only operates at a 1-dimensional level. This will not work as expected with 2-dimensional data returned from controls like the EDITTABLE.
// 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" |