Sign in
Log inSign up

Replacing "&" with ""

Zachary Stone's photo
Zachary Stone
·Nov 30, 2017

I created a method that takes in a string and checks for characters that typically doesn't play nice with URLs. All but the "&" char is being removed correctly.

Does anyone know why this is being ignored?

My Method:

   public static string URLify (string deviceName)
        {
            deviceName.Replace("/", "-").Replace("&", "").Replace(" ", "-").Replace("+", "");
            return deviceName;

        }
Hassle-free blogging platform that developers and teams love.
  • Docs by Hashnode
    New
  • Blogs
  • AI Markdown Editor
  • GraphQL APIs
  • Open source Starter-kit

© Hashnode 2024 — LinearBytes Inc.

Privacy PolicyTermsCode of Conduct