如何检查字符串以确保它仅包含数字、字母或空格?
在 C# 中这很简单:
private bool HasSpecialChars(string yourString) { return yourString.Any(ch => ! char.IsLetterOrDigit(ch)); }