Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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.

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.

Examples

Code Block
// 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"

...