Converts string from underscore format to camel case format, e.g. variable_name => variableName.

@param string $str the underscore formatted string to convert.
@return string the converted string.
167952
private static function underscore2CamelCase($str)
    {
        // Non-alpha and non-numeric characters become spaces.
        $str = preg_replace('/[^a-z0-9]+/i', ' ', $str);
        // Uppercase the first character of each word.
        $str = ucwords(trim($str));
        // Remove all spaces.
        $str = str_replace(" ", "", $str);
        // Lowercase the first character of the result.
        $str[0] = strtolower($str[0]);

        return $str;
    }
220699
protected static function convertToCamelCase($str)
    {
        $callback = function ($match) {
            return strtoupper($match[2]);
        };

        return lcfirst(preg_replace_callback('/(^|_)([a-z])/', $callback, $str));
    }
759900
protected function parseInterpolationString($str)
	{
		$parsed = [];

		if ( ! preg_match_all('~\{([a-z\d_\-\|\#]+?)\}~i', $str, $matches))
		{
			return $parsed;
		}

		foreach ($matches[1] as $key => $value)
		{
			$parsed[$matches[0][$key]] = explode('|', $value);
		}

		return $parsed;
	}
358362
public static function convertStringToXMLValue(string $str) : string
    {
        $str = str_replace("&amp;", "§", $str);
        $str = str_replace("&", "§", $str);
        $str = str_replace("§", "&amp;", $str);
        $str = str_replace("<", "&lt;", $str);
        $str = str_replace(">", "&gt;", $str);
        $str = str_replace("'", "&apos;", $str);
        $str = str_replace("\"", "&quot;", $str);

        return $str;
    }
10669
public static String toLowerCaseWithUnderscore(final String str) {
        if (N.isNullOrEmpty(str)) {
            return str;
        }

        String result = lowerCaseWithUnderscorePropNamePool.get(str);

        if (result == null) {
            result = StringUtil.toLowerCaseWithUnderscore(str);
            lowerCaseWithUnderscorePropNamePool.put(str, result);
        }

        return result;
    }
367028
public function unescape(String $str) : String
    {
        if( ! is_resource($this->init) )
        {
            throw new InvalidArgumentException(NULL, '$this->init');
        }

        return curl_unescape($this->init, $str);
    }
934247
static public function underscoredToReadable($str, $ucfirst = true) {
        if ($ucfirst) {
            $str = ucfirst($str);
        }
        $str = str_replace("_", " ", $str);
        return $str;
    }
1371299
public static function format($str)
    {
        preg_match('/<[A-Za-z0-9]+?>/', $str, $matches);

        foreach ($matches as $match) {
            $keyword = str_replace(array('<', '>'), '', $match);

            $format = static::$collection->get(strtolower($keyword));

            if (!empty($format)) {
                $foreground = (!isset($format['foreground']) ? '' : "\33[".$format['foreground']."m");
                $background = (!isset($format['background']) ? '' : "\33[".$format['background']."m");

                $str = str_replace(
                    array('<'.$keyword.'>', '</'.$keyword.'>'),
                    array($foreground.$background, "\33[0m"),
                    $str
                );
            }
        }

        return $str;
    }
655786
public static function toCamelCase($str)
  {
    // Convert words to uppercase and then remove spaces.
    $str = self::toSpaceSeparated($str);
    $str = ucwords($str);
    $str = str_ireplace(' ', '', $str);

    return $str;
  }
367949
public static function formataCPFCNPJ($str)
    {
        $str = preg_replace('![^\d]!', '', $str);
        if (11 == strlen($str) || 14 > strlen($str)) {
            $str = CPF::formatar($str);
        } elseif (14 <= strlen($str)) {
            $str = CNPJ::formatar($str);
        }

        return $str;
    }
584390
public static function before($str)
    {
        $str = str_replace('\\', '/', $str);
        $i = strrpos($str, '/');
        if ($i === false) {
            return $str;
        }

        return substr($str, 0, $i);
    }
835641
static public function fromCamel($str) {
      $str[0] = strtolower($str[0]);
      return preg_replace_callback('/([A-Z])/', function($char) {return "_" . strtolower($char[1]);}, $str);
  }
1161991
public function preProcessString($str)
    {
        $str = str_replace("<?php", "", $str);
        $str = str_replace("<?", "", $str);
        $str = str_replace("?>", "", $str);
        $str = str_replace("'", "\x22", $str);

        $str = trim($str);

        return $str;
    }
1168183
public static function toSMS($str) {
        $str = str_replace(array(' ', 'é', 'è', 'ó', 'à', 'â', ',', '?', "'"), array('+', '%E9', '%E8', 'o', '%E0', '%E2', '%82', '%3F', "%27"), $str);

        return $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);
    }
1283196
protected static function prepStr($str, $countSymb = 255)
    {
        //$str = str_replace(['-', '_'], ['', ''], $str);
        $len = strlen($str);
        $len = $len > $countSymb ? $countSymb : $len;
        return substr($str, 0, $len);
    }
1360541
private function _toupper($str)
    {
        // string can containing HTML tags
        $chunks = preg_split('/(<[^>]*>)/', $str, null, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);

        // convert toupper only the text between HTML tags
        foreach ($chunks as $idx => $chunk) {
            if ($chunk[0] != '<') {
                $chunks[$idx] = $this->_strtoupper($chunk);
            }
        }

        return implode($chunks);
    }