Displaying separated multi-line text fields The following code grabs the HTML-encoded, multi-line content of a text field. It then splits the content on line breaks, and finally displays it with commas as separators.

I would like to have this code reviewed to see if there is a simpler way to grab the string, split and display it.  

Note - I hated the idea of writing 2 collection iterations, but I found if a user in the CMS entered one line of real data, and then a couple of empty line breaks, it would throw the array length off and display a comma on a single item e.g. output should look like this :


Correct: Allowed Uses: example 1 | Allowed Uses: example 1, example 2  
Incorrect: Allowed Uses: example 1, | Allowed Uses: example 1, example 2,


  var retailBreaks = umbraco.library.ReplaceLineBreaks(Model.landAllowedUses);
  string[] retailBreaksSplit = retailBreaks.Split(new string[] { "&lt;br/&gt;" }, StringSplitOptions.RemoveEmptyEntries);
  int breaksLength = 0;
  List&lt;String&gt; repeatableProperty = new List&lt;String&gt;();
  foreach (string s in retailBreaksSplit)
  {
    if (!string.IsNullOrWhiteSpace(s))
       {
         repeatableProperty.Add(s);
       }
  }
 breaksLength = repeatableProperty.Count();

 &lt;div&gt;
    &lt;strong&gt;Allowed Uses:&lt;/strong&gt;

    @foreach (string s in repeatableProperty)
    {
     &lt;span class="comma-list"&gt;@s.Trim()@((breaksLength &gt; 1 &amp;&amp; repeatableProperty.Last&lt;string&gt;() != s) ? ", " : string.Empty)  &lt;/span&gt;
    }
&lt;/div&gt;
Just do a string replace to swap the html breaks for commas, then trim the end to remove any extra commas:

retailBreaks.Replace("&lt;br/&gt;",",").TrimEnd(',')