<?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>Separate out a pascal-case string</title><link>https://community.appian.com/discussions/f/general/22535/separate-out-a-pascal-case-string</link><description>I have an integration which makes a POST (read-only) to a database. The returned value is a string formatted in pascal-case. 
 There are a total of 25 possible string value responses, here are some examples from the 25 possibilities: 
 &amp;quot;DeferredStudentLoan</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88107?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:47:49 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dfe0f9d9-823a-4caa-a63f-9d489bc93b59</guid><dc:creator>ajhick</dc:creator><description>&lt;p&gt;All good! Mike linked the other thread so if people in future have this question again they are twice as likely now to find the answer! =)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88105?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:18:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:74f4996a-c392-4e20-ad25-582d3afbcca9</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;Yes, this example is built as a self-containing snippet so you can simply copy/paste into a New Rule and see it run.&amp;nbsp; In your environment, create a rule with whatever name you want and a ri!data (text) input as:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;joinarray( /* combine the array into a string */
  a!forEach(
    items: 1+enumerate(len(ri!data)), /* 1 item for each character */
    expression: a!localVariables(
      local!char: charat(ri!data,fv!index), /* retrieve the character at this index */
      if(
        or(
          fv!isFirst, /* first character, do not add a leading space */
          code(charat(ri!data,fv!index))&amp;gt;96 /* unicode value for this character, lowercase a-z are 97-122, upper case A-Z are 65-90 */
        ),
        local!char, /* add current character only */
        {&amp;quot; &amp;quot;,local!char} /* upper case detected, return a space and this character */
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88104?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:18:22 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:2eb08e71-fc90-47fc-ba4e-a8f17ac66d1f</guid><dc:creator>Micamack</dc:creator><description>&lt;p&gt;Thanks to the both of you. I just went and looked at that other thread as well. Tons of information - wish I found that thread before bothering both of yall!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88103?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:16:31 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:74d47814-549b-409c-afd6-784b1a3e4cb3</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Chris&amp;#39;s code (or my example or any of the other various examples at the prior thread I linked) should work for whatever string you want to pass into it.&amp;nbsp; Here Chris has hardcoded the local variable to an example string, but when you do it for real you&amp;#39;d simply set the local variable to hold the output of the integration where you get your ProperCamelCase string returned.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88102?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:12:47 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:c5fc39b2-0824-4fef-9a53-4581db5fb35f</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I was only able to find that thread (despite its recency) by searching on a keyword I knew I&amp;#39;d used and filtering to just threads I&amp;#39;ve participated in, so I don&amp;#39;t blame you there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88101?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:12:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:76e4e522-424c-4763-b4ca-2a908efcab84</guid><dc:creator>Micamack</dc:creator><description>&lt;p&gt;I can only sort of understand this code. Would I need to create a local variable for each possibility?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88100?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:06:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:28653460-3dac-466b-b6c2-920e38552374</guid><dc:creator>Micamack</dc:creator><description>&lt;p&gt;I tried :( - Spent about 45 minutes google&amp;#39;ing and trying different functions, also read through suggested posts when creating the topic :( haha.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88099?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 21:03:15 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6ab87fee-fda0-4ed0-9899-9efc298e038c</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;This is a good use case for the code() function to determine case of each character.&amp;nbsp; When you find an upper case, insert a space.&amp;nbsp; I would recommend creating a rule that converts each value such as below, then call the rule over your values to convert:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="csharp"&gt;a!localVariables(
  local!data: &amp;quot;DeferredStudentLoan&amp;quot;,
  
  joinarray(
    a!forEach(
      items: 1+enumerate(len(local!data)),
      expression: a!localVariables(
        local!char: charat(local!data,fv!index),
        if(
          or(
            fv!isFirst,
            code(charat(local!data,fv!index))&amp;gt;96
          ),
          local!char,
          {&amp;quot; &amp;quot;,local!char}
        )
      )
    )
  )
)&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Separate out a pascal-case string</title><link>https://community.appian.com/thread/88098?ContentTypeID=1</link><pubDate>Wed, 17 Nov 2021 20:55:55 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:66866b74-61b9-4c08-ae8c-a368a12711f7</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;Funny, someone asked &lt;a href="/discussions/f/general/22347/want-to-convert-indiachinafrance-to-india-china-france/87429#87429"&gt;basically the same thing&lt;/a&gt; just within the past few weeks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>