<?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>Split a string</title><link>https://community.appian.com/discussions/f/rules/26089/split-a-string</link><description>Hi, I have a string in DB which is: &amp;quot;&amp;lt;key&amp;gt;PROJECT_CODE&amp;lt;/key&amp;gt;&amp;lt;style&amp;gt;BOLD&amp;lt;/style&amp;gt;&amp;lt;color&amp;gt;#EF0010&amp;lt;/color&amp;gt;&amp;quot; 
 and I want your help to split this into different variables, like after splitting the above string 
 var1 will have value = PROJECT_CODE, 
 var2 will</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Split a string</title><link>https://community.appian.com/thread/102197?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2022 13:45:24 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f0947ee9-19ba-4724-bd12-23647a989cda</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I see there are some working implementations here already but I worry in some of those cases you could end up with some unintended side-effects, particularly if the data isn&amp;#39;t very clean for some reason at any point.&lt;/p&gt;
&lt;p&gt;My question is, do you know the XML key names in advance?&amp;nbsp; Like, &amp;quot;key&amp;quot;, &amp;quot;style&amp;quot;, and &amp;quot;color&amp;quot;, etc?&amp;nbsp; Will these vary widely, or always be exaclty the same?&lt;/p&gt;
&lt;p&gt;I&amp;#39;d think it might be the best idea to extract using the exact key names and go from there.&amp;nbsp; This would look more like &amp;#39;&lt;em&gt;&lt;strong&gt;extract(local!string, &amp;quot;&amp;lt;key&amp;gt;&amp;quot;, &amp;quot;&amp;lt;/key&amp;gt;&amp;quot;)&lt;/strong&gt;&lt;/em&gt;&amp;#39; - which would result in your output containing the exact string (without having to use additional functionality to remove the remnant XML characters) and protect you against dirty data (like anything containing miscellaneous &amp;quot;&amp;lt;&amp;quot; or &amp;quot;&amp;gt;&amp;quot; characters).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split a string</title><link>https://community.appian.com/thread/102186?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2022 11:19:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:cc37c055-1982-4ccc-b1d5-9c7cefeeea26</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;This one is more easier check this as well.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;reject(
  fn!isnull,
  extract(
    &amp;quot;&amp;lt;key&amp;gt;PROJECT_CODE&amp;lt;/key&amp;gt;&amp;lt;style&amp;gt;BOLD&amp;lt;/style&amp;gt;&amp;lt;color&amp;gt;#EF0010&amp;lt;/color&amp;gt;&amp;quot;,
    &amp;quot;&amp;gt;&amp;quot;,
    &amp;quot;&amp;lt;&amp;quot;
  ),
  
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split a string</title><link>https://community.appian.com/thread/102185?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2022 11:17:00 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:a4f48dee-f80e-43e7-97aa-8c60f550092a</guid><dc:creator>Himanshu</dc:creator><description>&lt;p&gt;Yes, it worked Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Split a string</title><link>https://community.appian.com/thread/102184?ContentTypeID=1</link><pubDate>Fri, 30 Sep 2022 11:15:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:298a5eb9-3abd-4b1d-bc0a-db493c24b692</guid><dc:creator>ujjwalr0002</dc:creator><description>&lt;p&gt;Try this.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;a!forEach(
  items: split(
    &amp;quot;&amp;lt;key&amp;gt;PROJECT_CODE&amp;lt;/key&amp;gt;&amp;lt;style&amp;gt;BOLD&amp;lt;/style&amp;gt;&amp;lt;color&amp;gt;#EF0010&amp;lt;/color&amp;gt;&amp;quot;,
    &amp;quot;&amp;gt;&amp;lt;&amp;quot;
  ),
  expression: striphtml(
    if(
      fv!isFirst,
      concat(fv!item,&amp;quot;&amp;gt;&amp;quot;),
      fv!isLast,
      concat(&amp;quot;&amp;lt;&amp;quot;,fv!item),
      concat(&amp;quot;&amp;lt;&amp;quot; ,fv!item,&amp;quot;&amp;gt;&amp;quot;)
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>