public static long getNumberLong ( CharSequence string ) { long number = 0l ; try { if ( ! isEmptyString ( string ) ) { if ( TextUtils . isDigitsOnly ( string ) ) { number = Long . parseLong ( 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 0l ;