Converts a string to boolean

@param  string  $str
@return boolean
772495
public static function toBoolean($str)
    {
        if (!is_string($str)) {
            throw new InvalidArgumentException(sprintf('String expected, %s received', gettype($str)));
        }

        $booleanTrue = array(
            '1',
            'on',
            'true',
            'yes',
        );
        if (in_array($str, $booleanTrue, true)) {
            return true;
        }
        $booleanFalse = array(
            '0',
            'off',
            'false',
            'no',
        );
        if (in_array($str, $booleanFalse, true)) {
            return false;
        }

        return false;
    }
186785
public function clean_string($str)
    {
        if ($this->is_ascii($str) === FALSE) {
            if (MB_ENABLED) {
                $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8');
            } elseif (ICONV_ENABLED) {
                $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
            }
        }

        return $str;
    }
529243
public function find($str) {
        while ($line = $this->recvLine()) {
            if (preg_match("/{$str}/", $line, $matches)) {
                return $matches[0];
            }
        }
        return false;
    }
141287
public static function strtoupper($str, bool $strict=false) {
		ref\mb::strtoupper($str, $strict);
		return $str;
	}
238277
protected function convertStringToBool($bool)
    {
        $bool = strtoupper($bool);

        if ($bool === strtoupper($this->schema->false())) {
            return false;
        } elseif ($bool === strtoupper($this->schema->true())) {
            return true;
        } else {
            return;
        }
    }
481623
public static final boolean toBoolean(String str, boolean trueIfNull) {
        if (str == null && trueIfNull) {
            return true;
        }

        return toBoolean(str);
    }
1129651
public function parseBool($s)
    {
        if (!is_string($s)) {
            return (bool) $s;
        }
        $result = false;
        switch (strtolower($s)) {
            case '1':
            case 'on':
            case 't':
            case 'true':
            case 'y':
            case 'yes':
                $result = true;
                break;
        }
        return $result;
    }
1319833
public static function isAlphaNum($str)
    {
        if (!is_string($str)) {
            throw new \ErrorException('Accept string ' . gettype($str) . ' given');
        }

        return (bool) preg_match('/^[a-zA-Z0-9]+$/', $str);
    }
513746
protected static function ourStrlen($str)
    {
        // Premature optimization: cache the function_exists() result
        static $exists = null;
        if ($exists === null) {
            $exists = \function_exists('\\mb_strlen');
        }

        // If it exists, we need to make sure we're using 8bit mode
        if ($exists) {
            return \mb_strlen($str, '8bit');
        }
        return \strlen($str);
    }
618762
protected function _stringHasR($str) {
		foreach (func_get_args() as $arg) {
			if (strpos($arg, "\r") !== false) {
				return true;
			}
		}
		return false;
	}
1373752
public static function strtolower($str, bool $strict=false) {
		ref\mb::strtolower($str, $strict);
		return $str;
	}
550051
def setting_str_to_bool(s):
    
    if isinstance(s, six.string_types):
        s = s.lower()
        if s == 'true':
            return True
        elif s == 'false':
            return False
        else:
            return ValueError('Invalid boolean representation: {!r}'.format(s))
    else:
        return s
1279817
public static function getString(&$str)
    {
        $p = strpos($str, "\x00");
        if ($p === false) {
            return '';
        }
        $r   = static::binarySubstr($str, 0, $p);
        $str = static::binarySubstr($str, $p + 1);

        return $r;
    }
1352445
public static function toBoolean($value)
    {
        if (is_string($value)) {
            if ($value === 'true') {
                $value = true;
            } else {
                $value = false;
            }
        } elseif (is_bool($value) === false) {
            $value = false;
        }

        return $value;
    }
431416
static private function ContainsSpace( 
                            string $str
    ) : bool {		
    
        $ret = false;
    
        for ( $i = 0; $i < strlen( $str ); $i++ ) {
            if ( ctype_space( substr( $str, $i, 1 ) ) ) {
                $ret = true;
                break;
            }
        }
        
        return $ret;
    
    }
835641
static public function fromCamel($str) {
      $str[0] = strtolower($str[0]);
      return preg_replace_callback('/([A-Z])/', function($char) {return "_" . strtolower($char[1]);}, $str);
  }
680854
public static function strlen($str) {
    if (is_array($str))
      return false;

    if (function_exists('mb_strlen'))
      return mb_strlen($str, 'UTF-8');

    return strlen($str);
  }