>public static string StrTran(string cSearchIn, string cSearchFor) > { > //Create the StringBuilder > StringBuilder sb = new StringBuilder(cSearchIn); > > //Call the Replace() method of the StringBuilder > return sb.Replace(cSearchFor," ").ToString(); > } >>
>public static string StrTran(string cSearchIn, string cSearchFor, string cReplaceWith) > { > //Create the StringBuilder > StringBuilder sb = new StringBuilder(cSearchIn); > > //There is a bug in the replace method of the StringBuilder > sb.Replace(cSearchFor, cReplaceWith); > > //Call the Replace() method of the StringBuilder and specify the string to replace with > return sb.Replace(cSearchFor, cReplaceWith).ToString(); > } >>
>public static string StrTran(string cSearchIn, string cSearchFor, string cReplaceWith, int nStartoccurence, int nCount) > { > //Create the StringBuilder > StringBuilder sb = new StringBuilder(cSearchIn); > > //There is a bug in the replace method of the StringBuilder > sb.Replace(cSearchFor, cReplaceWith); > > //Call the Replace() method of the StringBuilder specifying the replace with string, occurence and count > return sb.Replace(cSearchFor, cReplaceWith, nStartoccurence, nCount).ToString(); > } >