string RemoveBefore helper function

// <summary>
       ///if sToFind not found, then original string should be returned
       /// Otherwise removeBefore
       /// </summary>
       /// <param name="str"></param>
       /// <param name="sToFind"></param>
       /// <returns></returns>
       public static string RemoveBefore(this string str, string sToFind)
       {
           int num1 = str.IndexOf(sToFind);
           if (num1 > 0)
           {
               return str.Remove(0, num1);
           }
           else
           {
               return str;
           }
           
       }

posted @ Thursday, May 12, 2011 6:30 AM
Print

Comments on this entry:

No comments posted yet.

Your comment:



(not displayed)


 
 
 
 
 

Live Comment Preview:

 
«May»
SunMonTueWedThuFriSat
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789