Option 1: Use
C# Regex class[
^]. The codition to check: at least one non-digit character. So, the acceptance pattern could be
@"\D"
. E.g.
bool IsOk(s) { return Regex.IsMatch(s, @"\D"); }
Option 2: loop over all characters of the string an check with
char.IsDigit[
^] method if at least one character is not a digit, e.g.
bool IsOk(string s) { return s.Length > 0 && s.Any(c=>!char.IsDigit(c));
Cheers
Andi