ContainsNoSpaces

public static bool ContainsNoSpaces(this string s)
{
  var regex = new Regex(@"^[a-zA-Z0-9]+$");
  return regex.IsMatch(s);
}
Example:
if (!textBoxUserIdNew.Text.Trim().ContainsNoSpaces())

Description

Checks if a string contains no spaces

Details

Double click on the code to select all.

 

;