comefrom: <awangdev>8. String to Integer (atoi)_2.java
code: public int atoi(String str) {
          if (str == null || str.length() == 0) {
              return 0;
          }
          str = str.replaceAll("\\s","");
          if (!str.matches("[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)")) {
              return 0;
          }
          double rst = Double.parseDouble(str);
          if (rst > Integer.MAX_VALUE) {
              return Integer.MAX_VALUE;
          } else if (rst < Integer.MIN_VALUE) {
              return Integer.MIN_VALUE;
          } else {
              return (int)rst;
          }
      }
masked: public int sample_funcname ( String var_1 ) {
    if ( var_1 == null || var_1 . length ( ) == 0 ) {
      return 0 ;
    }
    var_1 = var_1 . replaceAll ( "\\s" , "" ) ;
    if ( ! var_1 . matches ( "[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)" ) ) {
      return 0 ;
    }
    double var_12 = Double . parseDouble ( var_1 ) ;
    if ( var_12 > Integer . MAX_VALUE ) {
      return Integer . MAX_VALUE ;
    }
    else if ( var_12 < Integer . MIN_VALUE ) {
      return Integer . MIN_VALUE ;
    }
    else {
      return ( int ) var_12 ;
    }
  }
  