Mega Code Archive

 
Categories / C# / Data Types
 

Replace Once

namespace Qxado.DataAccess.Implementation.Util {     using System.Text;     public static class StringHelper     {         public static string ReplaceOnce(string template, string placeholder, string replacement) {             var loc = template.IndexOf(placeholder);             return loc < 0 ? template : new StringBuilder(template.Substring(0, loc))                                             .Append(replacement)                                             .Append(template.Substring(loc + placeholder.Length))                                             .ToString();         }     } }