Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6204151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:02:23+00:00 2026-05-24T05:02:23+00:00

I have a URL formatter in my application but the problem is that the

  • 0

I have a URL formatter in my application but the problem is that the customer wants to be able to enter special characters like:

: | / – “ ‘ & * # @

I have a string:

string myCrazyString  = ":|/-\“‘&*#@";

I have a function where another string is being passed:

public void CleanMyString(string myStr)
{
} 

How can I compare the string being passed “myStr” to “myCrazyString” and if “myStr has any of the characters in myCrazyString to remove it?

So if I pass to my function:

“this ‘ is a” cra@zy: me|ssage/ an-d I& want#to clea*n it”

It should return:

“this is a crazy message and I want to clean it”

How can I do this in my CleanMyString function?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:02:24+00:00Added an answer on May 24, 2026 at 5:02 am

    Use Regular Expression for that Like:

    pattern = @"(:|\||\/|\-|\\|\“|\‘|\&|\*|\#|\@)";
    
    System.Text.RegularExpressions.Regex.Replace(inputString, pattern, string.Empty);
    
    • split each string you want to remove by |
    • To remove the special characters like the | itself use \, so \| this will handle the | as normal character.

    Test:

    inputString = @"H\I t&he|r#e!";
    //output is: HI there!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a url string like this: http://www.google.com/cse?cx=017840637368510444960:ny1lmky7r-0&client=google-csbe&output=xml_no_dtd&q=simon+g I need to send this url
I have an url like this: http://www.w3schools.com/PHP/func_string_str_split.asp I want to split that url to
I have a URL like /admin/editblogentry?page=3&color=blue I want to alter the 'page' in the
I have a URL formatted like this: http://testsite1/mm/page1.php?tID=18&tSerial=TEST TT 1 And here is my
I have URL like: http://example.com#something , how do I remove #something , without causing
I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST_TITLE%/ Now i want to
I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&web=%2F&page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace
I have an application that writes its own stylesheet, based off user input. It
I have a url formatted like this: http://www.example.com/detail/state-1/county-2/street-3 What I'd like to do is
I have a Django application that defines a one-to-many model relationship. The models look

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.