Removing spaces from a string

May 4, 2015 at 7:08 PM
I'm trying to use my razor template to create a portion of a URL that will link to each listed person's profile.

I am having trouble trying to figure out how to remove spaces whenever someone has a 2-part first name, e.g. Mary Ann.

Google has shown me what I used on the third line, but it's not working.
var url = + Person.lastname; // store person's name for URL
url = url.ToLower(); // convert URL to lowercase
url = url.Replace(" ", string.empty); // Remove spaces from URL
Any suggestions?
May 4, 2015 at 8:25 PM
Have you tried using:
url = url.Replace(" ", ""); 
That format is working for me.
May 5, 2015 at 1:07 PM
YES!!!! Thank you!