Mega Code Archive

 
Categories / C# / Data Types
 

Joins the strings with the speficied separator

//CruiseControl is open source software and is developed and maintained by a group of dedicated volunteers.  //CruiseControl is distributed under a BSD-style license. //http://cruisecontrol.sourceforge.net/ using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Text; using System.Text.RegularExpressions; namespace ThoughtWorks.CruiseControl.Core.Util {     /// <summary>     /// Class with handy stirng routines     /// </summary>     public class StringUtil     {         /// <summary>         /// joins the strings with the speficied separator.         /// </summary>         /// <param name="separator"></param>         /// <param name="strings"></param>         /// <returns></returns>         public static string Join(string separator, params string[] strings)         {             StringBuilder sb = new StringBuilder();             foreach (string s in strings)             {                 if (string.IsNullOrEmpty(s))                     continue;                 if (sb.Length > 0)                     sb.Append(separator);                 sb.Append(s);             }             return sb.ToString();         }    } }