public static float getNumberFloat ( CharSequence string ) { float number = 0.0f ; try { if ( ! isEmptyString ( string ) ) { number = Float . parseFloat ( string . toString ( ) ) ; } } catch ( NumberFormatException e ) { e . printStackTrace ( ) ; } return number ; }
Extract number from string failsafe . If the string is not a proper number it will always return 0 . 0f ;