CSharp examples for System:Char
Checks string to see whether all characters are digits
// The contents of this file are subject to the Common Public Attribution License Version 1.0 (the ?License?); using System.Globalization; using System.Text.RegularExpressions; using System.Text; using System.Collections.Generic; using System;/*from w w w. j a v a 2s . c o m*/ public class Main{ /// <summary> /// Checks string to see whether all characters are digits /// </summary> /// <param name="theString"></param> /// <returns></returns> public static bool IsDigitsOnly(string theString) { if( (theString == null) || (theString.Length == 0) ) return false; foreach(char c in theString) { if( !char.IsDigit(c) ) return false; } return true; } }