/** * <p>Convert a <code>String</code> to a <code>short</code>, returning * <code>zero</code> if the conversion fails.</p> * * <p>If the string is <code>null</code>, <code>zero</code> is returned.</p> * * <pre> * NumberUtils.toShort(null) = 0 * NumberUtils.toShort("") = 0 * NumberUtils.toShort("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the short represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static short toShort(String str) { return toShort(str, (short) 0); }
/** * <p>Convert a <code>String</code> to a <code>short</code>, returning * <code>zero</code> if the conversion fails.</p> * * <p>If the string is <code>null</code>, <code>zero</code> is returned.</p> * * <pre> * NumberUtils.toShort(null) = 0 * NumberUtils.toShort("") = 0 * NumberUtils.toShort("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the short represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static short toShort(String str) { return toShort(str, (short) 0); }
/** * <p>Convert a <code>String</code> to a <code>short</code>, returning * <code>zero</code> if the conversion fails.</p> * * <p>If the string is <code>null</code>, <code>zero</code> is returned.</p> * * <pre> * NumberUtils.toShort(null) = 0 * NumberUtils.toShort("") = 0 * NumberUtils.toShort("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the short represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static short toShort(String str) { return toShort(str, (short) 0); }
/** * <p>Convert a <code>String</code> to a <code>short</code>, returning * <code>zero</code> if the conversion fails.</p> * * <p>If the string is <code>null</code>, <code>zero</code> is returned.</p> * * <pre> * NumberUtils.toShort(null) = 0 * NumberUtils.toShort("") = 0 * NumberUtils.toShort("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the short represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static short toShort(String str) { return toShort(str, (short) 0); }
/** * <p>Convert a <code>String</code> to a <code>short</code>, returning * <code>zero</code> if the conversion fails.</p> * * <p>If the string is <code>null</code>, <code>zero</code> is returned.</p> * * <pre> * NumberUtils.toShort(null) = 0 * NumberUtils.toShort("") = 0 * NumberUtils.toShort("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the short represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static short toShort(String str) { return toShort(str, (short) 0); }
/** * <p>Convert a <code>String</code> to a <code>short</code>, returning * <code>zero</code> if the conversion fails.</p> * * <p>If the string is <code>null</code>, <code>zero</code> is returned.</p> * * <pre> * NumberUtils.toShort(null) = 0 * NumberUtils.toShort("") = 0 * NumberUtils.toShort("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the short represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static short toShort(String str) { return toShort(str, (short) 0); }