25 lines
638 B
C#
25 lines
638 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace TerribleDev.Blog.Web
|
|
{
|
|
public static class StringExtension
|
|
{
|
|
public static string WithoutSpecialCharacters(this string str)
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
foreach (char c in str)
|
|
{
|
|
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || c == '-')
|
|
{
|
|
sb.Append(c);
|
|
}
|
|
}
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|