Check that a string is a number.

@param num a string to be checked, it can be null
@return true if the string represents a number, false if it is not number
or it is null
195734
public static boolean isNumber(final String num) {
    if (num == null || num.length() == 0) {
      return false;
    }
    final boolean firstIsDigit = Character.isDigit(num.charAt(0));
    if (!firstIsDigit && num.charAt(0) != '-') {
      return false;
    }
    boolean dig = firstIsDigit;
    for (int i = 1; i < num.length(); i++) {
      if (!Character.isDigit(num.charAt(i))) {
        return false;
      }
      dig = true;
    }
    return dig;
  }
672002
private boolean isAllNumeric(TokenStream stream) {
    List<Token> tokens = ((NattyTokenSource) stream.getTokenSource()).getTokens();
    for(Token token:tokens) {
      try {
        Integer.parseInt(token.getText());
      } catch(NumberFormatException e) {
        return false;
      }
    }
    return true;
  }
1096208
public static boolean isAlphanumeric(String s) {
        if (isEmpty(s)) return defaultEmptyOK;

        // Search through string's characters one by one
        // until we find a non-alphanumeric character.
        // When we do, return false; if we don't, return true.
        for (int i = 0; i < s.length(); i++) {
            // Check that current character is number or letter.
            char c = s.charAt(i);

            if (!isLetterOrDigit(c)) return false;
        }

        // All characters are numbers or letters.
        return true;
    }
1272796
function isNumber(o)  {
    return o !== undefined && o !== null &&
          (typeof o === "number" || o.constructor === Number);
}
473784
public static boolean isNumeric(String string) {
        if (string == null || string.length() == 0)
            return false;

        int l = string.length();
        for (int i = 0; i < l; i++) {
            if (!Character.isDigit(string.codePointAt(i)))
                return false;
        }
        return true;
    }
720103
public boolean isNumber() {
        return ( this.simpleType == SimpleValueType.INTEGER ||
                 this.simpleType == SimpleValueType.DECIMAL ||
                 this.simpleType == SimpleValueType.CHAR || 
                 this.simpleType == SimpleValueType.NUMBER ) ;
    }
1122575
public static boolean isNumber(String str) {
		if (StrUtil.isBlank(str)) {
			return false;
		}
		char[] chars = str.toCharArray();
		int sz = chars.length;
		boolean hasExp = false;
		boolean hasDecPoint = false;
		boolean allowSigns = false;
		boolean foundDigit = false;
		// deal with any possible sign up front
		int start = (chars[0] == '-') ? 1 : 0;
		if (sz > start + 1) {
			if (chars[start] == '0' && chars[start + 1] == 'x') {
				int i = start + 2;
				if (i == sz) {
					return false; // str == "0x"
				}
				// checking hex (it can't be anything else)
				for (; i < chars.length; i++) {
					if ((chars[i] < '0' || chars[i] > '9') && (chars[i] < 'a' || chars[i] > 'f') && (chars[i] < 'A' || chars[i] > 'F')) {
						return false;
					}
				}
				return true;
			}
		}
		sz--; // don't want to loop to the last char, check it afterwords
				// for type qualifiers
		int i = start;
		// loop to the next to last char or to the last char if we need another digit to
		// make a valid number (e.g. chars[0..5] = "1234E")
		while (i < sz || (i < sz + 1 && allowSigns && !foundDigit)) {
			if (chars[i] >= '0' && chars[i] <= '9') {
				foundDigit = true;
				allowSigns = false;

			} else if (chars[i] == '.') {
				if (hasDecPoint || hasExp) {
					// two decimal points or dec in exponent
					return false;
				}
				hasDecPoint = true;
			} else if (chars[i] == 'e' || chars[i] == 'E') {
				// we've already taken care of hex.
				if (hasExp) {
					// two E's
					return false;
				}
				if (!foundDigit) {
					return false;
				}
				hasExp = true;
				allowSigns = true;
			} else if (chars[i] == '+' || chars[i] == '-') {
				if (!allowSigns) {
					return false;
				}
				allowSigns = false;
				foundDigit = false; // we need a digit after the E
			} else {
				return false;
			}
			i++;
		}
		if (i < chars.length) {
			if (chars[i] >= '0' && chars[i] <= '9') {
				// no type qualifier, OK
				return true;
			}
			if (chars[i] == 'e' || chars[i] == 'E') {
				// can't have an E at the last byte
				return false;
			}
			if (chars[i] == '.') {
				if (hasDecPoint || hasExp) {
					// two decimal points or dec in exponent
					return false;
				}
				// single trailing decimal point after non-exponent is ok
				return foundDigit;
			}
			if (!allowSigns && (chars[i] == 'd' || chars[i] == 'D' || chars[i] == 'f' || chars[i] == 'F')) {
				return foundDigit;
			}
			if (chars[i] == 'l' || chars[i] == 'L') {
				// not allowing L with an exponent
				return foundDigit && !hasExp;
			}
			// last character is illegal
			return false;
		}
		// allowSigns is true iff the val ends in 'E'
		// found digit it to make sure weird stuff like '.' and '1E-' doesn't pass
		return !allowSigns && foundDigit;
	}
499219
public static boolean isNumber(String value) {
        try {
            Double.parseDouble(value);
        } catch (NumberFormatException nfe) {
            return false;
        }
        return true;
    }
601310
public boolean isNumeral(final String input) {
        for (int i = 0; i < input.length(); i++) {
            if (!isNumeral(input.charAt(i))) {
                return false;
            }
        }
        return true;
    }
230677
private function _convert_number(&$num)
    {
        if (!empty($this->_params['only_integer']))
            $num = (int)$num;
        else
            $num = (float)$num;
    }
319602
public static boolean isInteger(String string)
  {
    if(string == null || string.isEmpty()) return false;
    int startIndex = string.charAt(0) == '-' ? 1 : string.charAt(0) == '+' ? 1 : 0;
    for(int i = startIndex, l = string.length(); i < l; i++) {
      if(string.charAt(i) == GROUPING_SEPARATOR) continue;
      if(!Character.isDigit(string.charAt(i))) {
        return false;
      }
    }
    return true;
  }
630083
function __isNumber(number) {
			if (!isChar(number)) invaildCharacter(number);
			var code = number.charCodeAt(0);
			return code >= ZERO && code <= NINE;
		}
768636
public boolean isAnyNumeric(){
    int cnt =0;
    for(int i=0;i<_cols.length;++i) {
      if( !_cols[i]._ignored && !_cols[i]._response && _cols[i]._isNumeric) {
        cnt = 1;
        break;
      }
    }
    if(cnt ==1) return true;
    else return false;
  }
735413
public boolean isNumeralPunctuation(final String input) {
        for (int i = 0; i < input.length(); i++) {
            if (!isNumeralPunctuation(input.charAt(i))) {
                return false;
            }
        }
        return true;
    }
948053
public static boolean containNumber(String str) {
		for (int i = 0; i < str.length(); i++) {
		    if (Character.isDigit(str.charAt(i))) {
			return true;
		    }
		}		
		return false;
    }
972772
public static boolean isCNNumericString(String str , int sIdx, int eIdx)
    {
        for ( int i = sIdx; i < eIdx; i++ ) {
            if ( ! cnNumeric.containsKey(str.charAt(i)) ) {
                return false;
            }
        }
        return true;
    }
514780
private static boolean isInteger( Number n ) {
      if( n instanceof Integer ){
         return true;
      }
      try{
         Integer.parseInt( String.valueOf( n ) );
         return true;
      }catch( NumberFormatException e ){
         return false;
      }
   }