Removes blanks and duplicates from a dynamic array.

NewArray = SRP_Clean_Array(Array, Delim, Option)

Returns

The cleaned array.

Parameters

ParameterDescription
ArrayThe dynamic array to be cleaned. Required.
DelimThe delimiter that separates elements in Array. Optional. If you omit this parameter, @FM will be assumed.
OptionSet this to "UNIQUE" to remove blanks and duplicate elements. Set this to "TRIM" to just remove trailling blanks. Leave blank to just remove all blanks. Optional. If you omit this parameter, "" will be assumed.

Remarks

Need to tidy up your array? Use SRP_Clean_Array 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 "UNIQUE" or 1. Leaving this 0 will still remove blanks, but duplicates will be left in the array.

To remove only trailing blanks, set the Option parameter to "TRIM" or 2. 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 0 will simply remove all blanks, including trailing blanks.

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_Clean_Array(Array)
// NewArray will be "Don":@FM:"Don":@FM:"Paul":@FM:"Frank":@FM:"Bob"

* Remove blanks using custom delimiter
Array = "Don~~Don~~Paul~~Frank~~Bob~~"
NewArray = SRP_Clean_Array(Array, "~")
// NewArray will be "Don~Don~Paul~Frank~Bob"

* Remove blanks and duplicates
Array = "Don~~Don~~Paul~~Frank~~Bob~~"
NewArray = SRP_Clean_Array(Array, "~", "UNIQUE")
// 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_Clean_Array(Array, @FM, "TRIM")
// NewArray will be "Don":@FM:@FM:@FM:"Don":@FM:@FM:@FM:"Paul":@FM:@FM:@FM:"Frank":@FM:@FM:@FM:"Bob"
  • No labels