Java Short Number Create toShort(String numeric)

Here you can find the source of toShort(String numeric)

Description

to Short

License

Open Source License

Declaration

public static short toShort(String numeric) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static short toShort(String numeric) {
        return (isNumeric(numeric)) ? Short.parseShort(numeric) : 0;
    }/*w ww  . ja  v  a 2  s  . c  om*/

    public static boolean isNumeric(String string) {
        return string.matches("[+-]?[0-9]+");
    }
}

Related

  1. toShort(Object value)
  2. toShort(Object value)
  3. toShort(Object value)
  4. toShort(Object value)
  5. toShort(String input, short defaultValue)
  6. toShort(String str)
  7. toShort(String str)
  8. toShort(String str, int maxLen)
  9. toShort(String str, short defaultValue)