C Sharp - Useful methods - 4 [ ReplaceSingleQuote]

Deepak
Posted by in C# category on for Intermediate level | Views : 6727 red flag

ReplaceSingleQuote

Replace Single Quote (') with Double Single Quotes ('')
ReplaceSingleQuote
Replace Single Quote (') with Double Single Quotes ('')

 

 

        /// <summary>
        /// Replace Single Quote (') with Double Single Quotes ('')
        /// </summary>
        /// <param name="value">string to replace</param>
        /// <returns>string</returns>
        public static string ReplaceSingleQuote( string value )
        {
            if ( !string.IsNullOrEmpty( value ) )
            {
                return value.Replace( "'" , "''" );
            }
            return value;
        }      

 

Page copy protected against web site content infringement by Copyscape

About the Author

Deepak
Full Name: Deepak Rao
Member Level: Starter
Member Status: Member
Member Since: 2/4/2009 10:10:50 PM
Country:

www.deepakrao.co.nr
I am an Indian Guy , working as Software Consultant in Bangalore . I am typical average programmer. One of those millions who earn their bread and butter from programming. I'm a software developer by profession, and I have a passion for books and music I am elder son to my parents, with an younger brother. Like most people, it's complicated thing to describe me. I am just inimitable, like many others. But I'll do the best I can to describe myself with words. I know that I am quite a smart person on most things, and also am exceedingly imaginative. I do feel that I am funny, though surely not everyone is funny all the time. My humor would probably best be labeled very wry and sarcastic, though it is quite fun to just plain laugh at the silliness of things lots of times.

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)