• How to remove words from a string in ASP.NET

    by  • May 26, 2014 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET, Microsoft VB.NET • 0 Comments

    Recently I was working on an application and I was in a situation where I have to remove some specific words from a string. Words were in comma separated format. So I have written a function which gets two string parameters and return a string value. First parameter is the input string which I have to clean from some specific words and the second parameter is a comma separated string of words which I want to remove. In my situation, I have saved these words in database in comma separated format. I bring these words from database when I need to remove from a string. In my below code, I am skipping the step of getting these words from database. I am just showing the function where I am removing these words from a string. It doesn’t  matter from where you are getting the input string and comma separated words, you just need to pass input string and comma separated words to call this function and get a clean string.

    Here is the function

    C#

    VB.NET

    Now you can call this function

    C#

    VB.NET




    Best WordPress Themes and Plugins with Great Team and Support!

    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply