public static long fromString(String val){
  String clean=val.replaceAll("\\D+","");
  return Long.parseLong(clean);
}

public static long fromString ( String val ) { String clean = val . replaceAll ( "\\D+" , "" ) ; return Long . parseLong ( clean ) ; }
interpret string as long value , striping everything but digits before parsing it .
