<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/discussions/f/rules/6170/how-would-i-trim-a-mix-of-newline-and-space-characters-from-the-beginning-and-en</link><description>how would I trim a mix of newline and space characters from the beginning and end of a text string? For example, &amp;quot; this is a string &amp;quot; becomes &amp;quot;this is a string&amp;quot; OriginalPostID-174728 OriginalPostID-174728</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/75926?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2020 15:42:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:913a3ede-8b9d-4f70-92f7-e89223bceffe</guid><dc:creator>Janaki Devi A</dc:creator><description>&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;To remove mix of newline and space characters in the beginning of a text&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Create two rules which works in recursive manner&lt;/p&gt;
&lt;p&gt;rule1:&lt;/p&gt;
&lt;p&gt;with(&lt;br /&gt; local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;br /&gt; regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},ri!input)),&lt;br /&gt; local!correctvalue:&lt;br /&gt; if(rule!APN_isBlank(local!regexMatch),{},&lt;br /&gt; replace(ri!input,1,(search(local!regexMatch,ri!input,1)),&amp;quot;&amp;quot;)),&lt;br /&gt; if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;br /&gt; if(rule!APN_isBlank(regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},local!correctvalue)),local!correctvalue,&lt;br /&gt; rule!rule2(input:local!correctvalue))))&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;rule2:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;with(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;/span&gt;&lt;br /&gt;&lt;span&gt;regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},ri!input)),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!correctvalue:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isBlank(local!regexMatch),{},&lt;/span&gt;&lt;br /&gt;&lt;span&gt;replace(ri!input,1,(search(local!regexMatch,ri!input,1)),&amp;quot;&amp;quot;)),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isBlank(regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},local!correctvalue)),local!correctvalue,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;rule!&lt;/span&gt;&lt;span&gt;rule1&lt;/span&gt;&lt;span&gt;(input:local!correctvalue)))&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;saveInto in the interface:&lt;/p&gt;
&lt;p&gt;saveInto: {&lt;br /&gt;a!save(local!input,save!value),&lt;br /&gt;a!save(&lt;br /&gt;ri!input,if(regexmatch(&amp;quot;^[ \n]*$&amp;quot;,save!value),{},&lt;br /&gt;rule!rule1(input:save!value)))}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;To remove mix of newline and space characters at the end of a text&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Create two rules which works in recursive manner&lt;/p&gt;
&lt;p&gt;rule1:&lt;/p&gt;
&lt;p&gt;with(&lt;br /&gt; local!length:len(ri!input),&lt;br /&gt; local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;br /&gt; regexmatch({&amp;quot;[$|\s]&amp;quot;},index(ri!input,local!length,{}))),&lt;br /&gt; local!correctvalue:&lt;br /&gt; if(local!regexMatch,&lt;br /&gt; replace(ri!input,local!length,1,&amp;quot;&amp;quot;),{}),&lt;br /&gt; if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;br /&gt; if(regexmatch({&amp;quot;[$|\s]&amp;quot;},index(local!correctvalue,len(local!correctvalue),{})), &lt;br /&gt; rule!rule2(input:local!correctvalue),&lt;br /&gt; local!correctvalue,&lt;br /&gt; )))&lt;/p&gt;
&lt;p&gt;rule2:&lt;/p&gt;
&lt;p&gt;&lt;span&gt;with(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!length:len(ri!input),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;/span&gt;&lt;br /&gt;&lt;span&gt;regexmatch({&amp;quot;[$|\s]&amp;quot;},index(ri!input,local!length,{}))),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!correctvalue:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(local!regexMatch,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;replace(ri!input,local!length,1,&amp;quot;&amp;quot;),{}),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(regexmatch({&amp;quot;[$|\s]&amp;quot;},index(local!correctvalue,len(local!correctvalue),{})),&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span&gt;rule!&lt;/span&gt;&lt;span&gt;rule1&lt;/span&gt;&lt;span&gt;(input:local!correctvalue),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!correctvalue,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;))&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;SaveInto in the interface:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;saveInto: {&lt;br /&gt; a!save(local!input,save!value),&lt;br /&gt; a!save(&lt;br /&gt; ri!input,&lt;br /&gt; rule!rule1(input:save!value))}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;to remove empty space in the beginning and at end, in save into call these rules one after the other and then save value&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/75925?ContentTypeID=1</link><pubDate>Wed, 12 Aug 2020 15:36:35 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:13434da8-e3ec-434a-90b7-b64f8b4bec9d</guid><dc:creator>Janaki Devi A</dc:creator><description>&lt;p&gt;&lt;strong&gt;To remove mix of newline and space characters in the beginning of a text&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Create two rules which works in recursive manner&lt;/p&gt;
&lt;p&gt;rule1:&lt;/p&gt;
&lt;p&gt;with(&lt;br /&gt; local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;br /&gt; regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},ri!input)),&lt;br /&gt; local!correctvalue:&lt;br /&gt; if(rule!APN_isBlank(local!regexMatch),{},&lt;br /&gt; replace(ri!input,1,(search(local!regexMatch,ri!input,1)),&amp;quot;&amp;quot;)),&lt;br /&gt; if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;br /&gt; if(rule!APN_isBlank(regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},local!correctvalue)),local!correctvalue,&lt;br /&gt; rule!rule2(input:local!correctvalue))))&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;rule2:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;with(&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;/span&gt;&lt;br /&gt;&lt;span&gt;regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},ri!input)),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;local!correctvalue:&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isBlank(local!regexMatch),{},&lt;/span&gt;&lt;br /&gt;&lt;span&gt;replace(ri!input,1,(search(local!regexMatch,ri!input,1)),&amp;quot;&amp;quot;)),&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;if(rule!APN_isBlank(regexfirstmatch({&amp;quot;^[\s]+|[\s]+$]&amp;quot;},local!correctvalue)),local!correctvalue,&lt;/span&gt;&lt;br /&gt;&lt;span&gt;rule!&lt;/span&gt;&lt;span&gt;rule1&lt;/span&gt;&lt;span&gt;(input:local!correctvalue)))&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;saveInto in the interface:&lt;/p&gt;
&lt;p&gt;saveInto: {&lt;br /&gt; a!save(local!input,save!value),&lt;br /&gt; a!save(&lt;br /&gt; ri!input,if(regexmatch(&amp;quot;^[ \n]*$&amp;quot;,save!value),{},&lt;br /&gt; rule!rule1(input:save!value)))}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To remove mix of newline and space characters in the&amp;nbsp;end of a text&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Create two rules which works in recursive manner&lt;/p&gt;
&lt;p&gt;rule1:&lt;/p&gt;
&lt;p&gt;with(&lt;br /&gt; local!length:len(ri!input),&lt;br /&gt; local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;br /&gt; regexmatch({&amp;quot;[$|\s]&amp;quot;},index(ri!input,local!length,{}))),&lt;br /&gt; local!correctvalue:&lt;br /&gt; if(local!regexMatch,&lt;br /&gt; replace(ri!input,local!length,1,&amp;quot;&amp;quot;),{}),&lt;br /&gt; if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;br /&gt; if(regexmatch({&amp;quot;[$|\s]&amp;quot;},index(local!correctvalue,len(local!correctvalue),{})), &lt;br /&gt; rule!rule2(input:local!correctvalue),&lt;br /&gt; local!correctvalue,&lt;br /&gt; )))&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;rule2:&lt;/p&gt;
&lt;p&gt;with(&lt;br /&gt;local!length:len(ri!input),&lt;br /&gt;local!regexMatch:if(rule!APN_isBlank(ri!input),{},&lt;br /&gt;regexmatch({&amp;quot;[$|\s]&amp;quot;},index(ri!input,local!length,{}))),&lt;br /&gt;local!correctvalue:&lt;br /&gt;if(local!regexMatch,&lt;br /&gt;replace(ri!input,local!length,1,&amp;quot;&amp;quot;),{}),&lt;br /&gt;if(rule!APN_isEmpty(local!correctvalue),ri!input,&lt;br /&gt;if(regexmatch({&amp;quot;[$|\s]&amp;quot;},index(local!correctvalue,len(local!correctvalue),{})),&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;rule!rule2(input:local!correctvalue),&lt;br /&gt;local!correctvalue,&lt;br /&gt;)))&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;saveInto in the interface:&lt;/p&gt;
&lt;p&gt;saveInto: {&lt;br /&gt; a!save(local!input,save!value),&lt;br /&gt; a!save(&lt;br /&gt; ri!input,&lt;br /&gt; rule!rule1(input:save!value))}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In SaveInto, rules for removing space in the beginning and end can be called one after the other and save the value&lt;/p&gt;
&lt;p&gt;Hope this helps&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/70968?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 13:00:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e24434c4-3848-4b32-a596-2d27e9746f21</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;It&amp;#39;s hard to know exaclty what the original poster&amp;#39;s use case was from over 4 years ago, but it seems to me that they didn&amp;#39;t want to remove&amp;nbsp;&lt;em&gt;all&lt;/em&gt; newlines, just extraneous ones (seemingly only at the beginning or end of a string).&amp;nbsp; I&amp;#39;m sure there&amp;#39;s now a more graceful coding solution than the original one I posted so long ago, though it&amp;#39;s always fun to see my name pop up in a newly-revived thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/70967?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 11:23:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:b1bf5fd5-910d-430f-9e50-b2c6206a84cd</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;I just noticed the previous replies that reference use of char(13) alongside char(10)...so the principle remains the same, but you&amp;#39;d iterate over the string to substitute both with a space and then tidy it all up with trim():&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;fn!trim(
  fn!reduce(
    fn!substitute,
    ri!myString,
    {char(10),char(13)},
    &amp;quot; &amp;quot;
  )
)&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Obviously you can extend the list of characters to be excluded as needed..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/70966?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 11:17:03 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:350266cb-5215-4e61-b92d-29b2bd8d8c64</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;I would start by substituting all &amp;quot;new line&amp;quot; characters with a space; and then use trim() to remove all unnecessary spaces. So:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;fn!trim(
  fn!substitute(
    ri!myString,
    char(
      10
    ),
    &amp;quot; &amp;quot;
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/70965?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 10:21:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:69a56935-9ef5-44a3-8461-eba01587d494</guid><dc:creator>Saurabh Rajnala</dc:creator><description>&lt;p&gt;Hi you can convert everything to unicode and use the indices of the first non newline and non spaces to select the text between spaces and newlines by making the use of mid() in this manner:&lt;/p&gt;
&lt;p&gt;load(&lt;br /&gt; local!unicode: code(ri!input),&lt;br /&gt; local!indices: enumerate(length(local!unicode))+1,&lt;br /&gt; local!newlineAndSpaceIndices: append(wherecontains(10, local!unicode), wherecontains(32, local!unicode)),&lt;br /&gt; local!textIndices: difference(local!indices, local!newlineAndSpaceIndices),&lt;br /&gt; local!finalText: mid(&lt;br /&gt; ri!input, &lt;br /&gt; index(local!textIndices, 1, {}), &lt;br /&gt; index(local!textIndices, length(local!textIndices), {}) - index(local!textIndices, 1, {}) + 1&lt;br /&gt; ),&lt;br /&gt; local!finalText&lt;br /&gt;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/23955?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2015 00:37:38 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:72282fc1-07e7-4c58-9092-fc336320489f</guid><dc:creator>Mike Schmitt</dc:creator><description>Yup, you&amp;#39;re right about joinarray - so there&amp;#39;s actually no need to do the remove() operation in my example above, good catch.  I&amp;#39;m not sure what OP&amp;#39;s intentions really are with respect to having extra (just single) newlines between text elements or not - that would require some extra tweak that i&amp;#39;m not immediately thinking of.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/23954?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2015 00:35:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:15c7e9aa-a2f4-4558-be5f-f66a24521529</guid><dc:creator>Dan Lluhi</dc:creator><description>@mschmitt nice catch on the newline. Your solution looks great, the only thing I can think of that could be might need to be tweaked is if @srinivasm needs to retain consecutive newlines in the middle of the string. Rejoining the split array on char(10) will only add single newlines, so something like &lt;br /&gt;"a&lt;br /&gt;&lt;br /&gt;b" &lt;br /&gt;will change to&lt;br /&gt;"a&lt;br /&gt;b".&lt;br /&gt;Also I believe joinarray ignores empty strings, so removing nulls may not be required.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/23953?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2015 00:32:18 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:aff1be2b-f518-4bb3-88a5-cf73b4488109</guid><dc:creator>Mike Schmitt</dc:creator><description>I&amp;#39;ve come up with the following which seems to work:&lt;br /&gt;&lt;br /&gt;with(&lt;br /&gt;  &lt;br /&gt;  local!array: split(&lt;br /&gt;    substitute(ri!text, char(13), &amp;quot;&amp;quot;),&lt;br /&gt;    /* removing char(13)s first - newlines will ALWAYS have char(10) and SOMETIMES also char(13) */&lt;br /&gt;    char(10)&lt;br /&gt;  ),&lt;br /&gt;  &lt;br /&gt;  local!secondArray: remove(&lt;br /&gt;    local!array,&lt;br /&gt;    where(&lt;br /&gt;      apply(&lt;br /&gt;        rule!APN_isBlank(_),&lt;br /&gt;        local!array&lt;br /&gt;      )&lt;br /&gt;    )&lt;br /&gt;  ),&lt;br /&gt;  &lt;br /&gt;  trim(joinArray(local!secondArray, char(10)))&lt;br /&gt;)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/23952?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2015 00:25:01 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:decc800b-942b-40f4-8e7a-5a5b21b13ace</guid><dc:creator>srinivasm</dc:creator><description>Thanks, that looks helpful. I&amp;#39;ll try it out&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/23950?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2015 00:20:14 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2d100767-08cf-42ac-99cb-c0e944140f18</guid><dc:creator>Mike Schmitt</dc:creator><description>@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.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how would I trim a mix of newline and space characters from the beginning and en</title><link>https://community.appian.com/thread/23948?ContentTypeID=1</link><pubDate>Sat, 24 Oct 2015 00:03:05 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d72cad73-f0ac-4e5a-8e24-04b8611fd918</guid><dc:creator>Dan Lluhi</dc:creator><description>Hi, check out the trim() function &lt;a href="https://forum.appian.com/suite/help/7.11/Text_Functions.html#trim.28.29"&gt;forum.appian.com/.../Text_Functions.html&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>