<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Replace internal spaces in string in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508351#M4285494</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the fixed length of the last name field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, do first names and initials also have fixed lengths?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you paste an example string as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Abhilash &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Feb 2016 18:57:02 GMT</pubDate>
    <dc:creator>abhilash_kumar</dc:creator>
    <dc:date>2016-02-16T18:57:02Z</dc:date>
    <item>
      <title>Replace internal spaces in string</title>
      <link>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaq-p/11508350</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have only recently begun using Crystal Reports 2013.&amp;nbsp; I am having a problem with eliminating errors when creating formulas.&amp;nbsp; I have a database field which is a composite of a fixed length Last Name, First Name and Middle Initial.&amp;nbsp; Because it was fixed length the last name is followed by multiple spaces prior to adding the first name.&amp;nbsp; I would like to remove all the redundant spaces and replace them with a comma and single space.&amp;nbsp; The Replace function, by itself, cannot give me what I need.&amp;nbsp; I have tried multiple times to employ a Do While or a While End While loops to to surround the Replace function, but I continue to receive the same error message of: "The keyword 'do' is missing"&amp;nbsp; Obviously, the keyword is not missing regardless of what case the statement uses.&amp;nbsp; I am at a loss to get the Do While loop to work.&amp;nbsp; I have attempted many different variations and all of them throw this same error.&amp;nbsp; The last formula I attempted looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Do While&lt;/SPAN&gt; {CFTVMA2000.PrvName}.Contains("&amp;nbsp; ")&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Replace&lt;/SPAN&gt;({CFTVMA2000.PrvName},"&amp;nbsp; ",", "&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;Loop&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;SPAN style="color: #000000;"&gt;I realize that the full syntax may not be correct but I cannot get past the missing 'do' error!&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 18:26:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaq-p/11508350</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-02-16T18:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: Replace internal spaces in string</title>
      <link>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508351#M4285494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ron,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is the fixed length of the last name field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, do first names and initials also have fixed lengths?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you paste an example string as well?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Abhilash &lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 18:57:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508351#M4285494</guid>
      <dc:creator>abhilash_kumar</dc:creator>
      <dc:date>2016-02-16T18:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: Replace internal spaces in string</title>
      <link>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508352#M4285495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try using this formula and let me know if this works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;local stringvar ss := &lt;SPAN style="color: #333333; font-size: 12px;"&gt; {CFTVMA2000.PrvName}&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;local stringvar array arr := split(ss,' ');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;local numbervar i;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;local stringvar fin;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;for i := 1 to ubound(arr) do&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if i = 1 AND (arr[i] &amp;lt;&amp;gt; ' ' or arr[i] &amp;lt;&amp;gt; '') then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fin := arr[i] + ', '&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if arr[i] &amp;lt;&amp;gt; ' ' or arr[i] &amp;lt;&amp;gt; '' then&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fin := fin + arr[i] + ' ';&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fin;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;-Abhilash&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 19:04:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508352#M4285495</guid>
      <dc:creator>abhilash_kumar</dc:creator>
      <dc:date>2016-02-16T19:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Replace internal spaces in string</title>
      <link>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508353#M4285496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;THANK YOU!&amp;nbsp; What you sent worked just fine.&amp;nbsp; I was not sure of the original field sizes were but would appear to be around 13-14 characters.&amp;nbsp; Still I have the question of why the Do While loop does not work and always states the 'do' is missing?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Feb 2016 19:41:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/replace-internal-spaces-in-string/qaa-p/11508353#M4285496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2016-02-16T19:41:54Z</dc:date>
    </item>
  </channel>
</rss>

