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;

        }