/** * <p>Convert a <code>String</code> to a <code>byte</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.toByte(null) = 0 * NumberUtils.toByte("") = 0 * NumberUtils.toByte("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the byte represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static byte toByte(String str) { return toByte(str, (byte) 0); }
/** * <p>Convert a <code>String</code> to a <code>byte</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.toByte(null) = 0 * NumberUtils.toByte("") = 0 * NumberUtils.toByte("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the byte represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static byte toByte(String str) { return toByte(str, (byte) 0); }
/** * <p>Convert a <code>String</code> to a <code>byte</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.toByte(null) = 0 * NumberUtils.toByte("") = 0 * NumberUtils.toByte("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the byte represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static byte toByte(String str) { return toByte(str, (byte) 0); }
/** * <p>Convert a <code>String</code> to a <code>byte</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.toByte(null) = 0 * NumberUtils.toByte("") = 0 * NumberUtils.toByte("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the byte represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static byte toByte(String str) { return toByte(str, (byte) 0); }
/** * <p>Convert a <code>String</code> to a <code>byte</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.toByte(null) = 0 * NumberUtils.toByte("") = 0 * NumberUtils.toByte("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the byte represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static byte toByte(String str) { return toByte(str, (byte) 0); }
/** * <p>Convert a <code>String</code> to a <code>byte</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.toByte(null) = 0 * NumberUtils.toByte("") = 0 * NumberUtils.toByte("1") = 1 * </pre> * * @param str the string to convert, may be null * @return the byte represented by the string, or <code>zero</code> if * conversion fails * @since 2.5 */ public static byte toByte(String str) { return toByte(str, (byte) 0); }