comefrom: <gouthampradhan>string_StringToInteger_1.java
code: public int myAtoi(String str) {
      boolean isPositive = true;
      if (str == null || str.trim().isEmpty()) return 0;
      str = str.trim();
      if (str.charAt(0) == '+') {
        isPositive = true;
        str = str.substring(1, str.length());
      } else if (str.charAt(0) == '-') {
        isPositive = false;
        str = str.substring(1, str.length());
      } else if (str.charAt(0) > '9' || str.charAt(0) < '0') return 0;
      int i = 0;
      for (int l = str.length(); i < l; i++) {
        if (str.charAt(i) > '9' || str.charAt(i) < '0') break;
      }
      str = str.substring(0, i);
      long num = 0;
      for (int j = 0, l = str.length(); j < l; j++) {
        int n = (str.charAt(j) - '0');
        num *= 10;
        num += n;
        if (isPositive) {
          if (num > Integer.MAX_VALUE) return Integer.MAX_VALUE;
        } else {
          if ((num * -1) < Integer.MIN_VALUE) return Integer.MIN_VALUE;
        }
      }
      if (isPositive) return (int) num;
      else return (int) (num * -1);
    }
masked: public int sample_funcname ( String var_1 ) {
    boolean var_21 = true ;
    if ( var_1 == null || var_1 . trim ( ) . isEmpty ( ) ) return 0 ;
    var_1 = var_1 . trim ( ) ;
    if ( var_1 . charAt ( 0 ) == '+' ) {
      var_21 = true ;
      var_1 = var_1 . substring ( 1 , var_1 . length ( ) ) ;
    }
    else if ( var_1 . charAt ( 0 ) == '-' ) {
      var_21 = false ;
      var_1 = var_1 . substring ( 1 , var_1 . length ( ) ) ;
    }
    else if ( var_1 . charAt ( 0 ) > '9' || var_1 . charAt ( 0 ) < '0' ) return 0 ;
    int var_15 = 0 ;
    for ( int var_16 = var_1 . length ( ) ;
    var_15 < var_16 ;
    var_15 ++ ) {
      if ( var_1 . charAt ( var_15 ) > '9' || var_1 . charAt ( var_15 ) < '0' ) break ;
    }
    var_1 = var_1 . substring ( 0 , var_15 ) ;
    long var_17 = 0 ;
    for ( int var_18 = 0 , var_16 = var_1 . length ( ) ;
    var_18 < var_16 ;
    var_18 ++ ) {
      int var_19 = ( var_1 . charAt ( var_18 ) - '0' ) ;
      var_17 *= 10 ;
      var_17 += var_19 ;
      if ( var_21 ) {
        if ( var_17 > Integer . MAX_VALUE ) return Integer . MAX_VALUE ;
      }
      else {
        if ( ( var_17 * - 1 ) < Integer . MIN_VALUE ) return Integer . MIN_VALUE ;
      }
    }
    if ( var_21 ) return ( int ) var_17 ;
    else return ( int ) ( var_17 * - 1 ) ;
  }
  