is Numeric - CSharp System

CSharp examples for System:String Convert

Description

is Numeric

Demo Code

//  Copyright by Contributors
using System.IO;/*from   w  w w.  ja v a 2  s. c om*/
using System.Runtime.Serialization.Formatters.Binary;
using System.Collections;
using System.Runtime.CompilerServices;
using System.Text;
using System.Collections.Generic;
using System;

public class Main{
        //[MethodImpl(MethodImplOptions.Synchronized)]
        public static bool isNumeric(string s)
        {
            if (String.IsNullOrEmpty(s))
            {
                return false;
            }
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] < '0' || s[i] > '9')
                {
                    return false;
                }
            }
            return true;
        }
}

Related Tutorials