Remove illegal characters from string

28/01/2014 15:46

//To use when creating site collection url from title

 private static string CleanSiteTitle(string input)
        {
            string inputWithoutSpaces = Regex.Replace(input, " ", string.Empty);
            return Path.GetInvalidFileNameChars().Aggregate(inputWithoutSpaces, (current, c) => current.Replace(c.ToString(), string.Empty));
        }