I am building a string of last names separated by hyphens. Sometimes a whitespace gets caught in there. I need to remove all whitespace from end result.
Sample strin
Below is the code that would replace the white space from the file name into given URL and also we can remove the same by using string.empty instead of "~"
if (!string.IsNullOrEmpty(url))
{
string origFileName = Path.GetFileName(url);
string modiFileName = origFileName.Trim().Replace(" ", "~");
url = url.Replace(origFileName , modiFileName );
}
return url;