Web- und Software Development

Regex Sonderzeichen entfernen – C# Quicky

Written By: Mario Priebe - Feb• 19•09

Dieser kleine Schnipsel entfernt alle Sonder- und Leerzeichen.


1
using System.Text.RegularExpressions;
1
2
3
4
5
6
#region helper
private string AdjustInput(string input)
{
    return Regex.Replace(input, @"[^a-zA-Z0-9]", string.Empty);
}
#endregion



Ähnliche Beiträge

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

One Comment

  1. Mario sagt:

    Möglich wäre auch:

    1
    
    return string.Join(null, Regex.Split(value, "[^a-zA-Z0-9]"));