Geeks With Blogs

News My Blog has been MOVED to https://mfreidge.wordpress.com
Michael Freidgeim's OLD Blog My Blog has been MOVED to https://mfreidge.wordpress.com
I've created a helper function, that allows me to set extra CSS class name(space separated)
public static string AppendIfNotContains(string str, string sToAppend, string delimeter)
            {
                if (!str.Contains(sToAppend))
                {
                    str = AppendWithDelimeter(str, sToAppend, delimeter);
                }
                return str;
            }
public static string AppendWithDelimeter(string str, string sToAppend, string delimeter)
            {
                if ((!str.EndsWith(delimeter) & !String.IsNullOrEmpty(str)) & !String.IsNullOrEmpty(sToAppend))
                {
                    str = str + delimeter;
                }
                str = str + sToAppend;
                return str;
            }
Posted on Sunday, March 2, 2008 3:00 PM .Net Framework | Back to top


Comments on this post: AppendIfNotContains string helper method

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Michael Freidgeim | Powered by: GeeksWithBlogs.net