how would I trim a mix of newline and space characters from the beginning and en

how would I trim a mix of newline and space characters from the beginning and end of a text string? For example,
"
this is
a string

" becomes
"this is
a string"

OriginalPostID-174728

OriginalPostID-174728

  Discussion posts and replies are publicly visible

Parents
  • @srinivasm: i've noticed also that trim() doesn't handle extra newlines. I would suggest perhaps devising custom functionality for this. The way I'd start out is to split the original string on the newline character - char(10) - then take that array and remove nulls. The remaining array members can be rejoined using joinArray(), where the separator is char(10) again; and then that result passed back through trim() to handle extra spaces on each line. This is off the top of my head so may require tweaking, but should get you close.
Reply
  • @srinivasm: i've noticed also that trim() doesn't handle extra newlines. I would suggest perhaps devising custom functionality for this. The way I'd start out is to split the original string on the newline character - char(10) - then take that array and remove nulls. The remaining array members can be rejoined using joinArray(), where the separator is char(10) again; and then that result passed back through trim() to handle extra spaces on each line. This is off the top of my head so may require tweaking, but should get you close.
Children
No Data