Helper function to generate regular expression with an upper and lower limit.

@param int $lower
@param int $upper
@return string
550737
protected static function limit($lower, $upper)
    {
        if (($lower < 0) || ($upper <= 0) || ($upper < $lower)) {
            throw new \InvalidArgumentException();
        }

        return '{' . $lower . ',' . $upper . '}';
    }
1365623
function upper (value) {
  if (value === null || value === undefined) {
    return value
  }
  return String.prototype.toUpperCase.call(value)
}
966153
public static function limit($value, $limit = 100, $end = '...')
    {
        if (mb_strwidth($value, 'UTF-8') <= $limit) {
            return $value;
        }

        return rtrim(mb_strimwidth($value, 0, $limit, '', 'UTF-8')).$end;
    }
655221
private static function parse($limit)
    {
        $suffix = substr($limit, -1);
        if (isset(self::$metrics[$suffix])) {
            return floatval($limit) * self::$metrics[$suffix];
        } else {
            throw new \InvalidArgumentException(sprintf(
                'The limit(%s) not valid value! Valid values: 10K, 10M, 10G, or more',
                $limit
            ));
        }
    }
660303
public static function upperCase($strText, $strEncoding = '')
    {

        if (is_null(self::$blnMbstring)) {
            self::$blnMbstring = extension_loaded('mbstring');
        }

        if (!self::$blnMbstring) {
            $strUpperCaseText = strtoupper($strText);
        } else {
            if ($strEncoding == '') {
                $strUpperCaseText = mb_strtoupper($strText);
            } else {
                $strUpperCaseText = mb_strtoupper($strText, $strEncoding);
            }
        }

        return $strUpperCaseText;
    }
1215045
public function split($regex = '//u', $limit = -1){
		
		if(!\is_string($regex)){
			throw new \InvalidArgumentException('$regex is not a string');
		}
		
		if(!\is_numeric($limit)){
			throw new \InvalidArgumentException('$limit is not a number');
		}
		
		return \preg_split($regex, $this->_Value, $limit, \PREG_SPLIT_NO_EMPTY);
		
	}
545557
private function computeLowerAndUpperBounds($range)
    {
        if (strpos($range, '/') !== false) {
            // support CIDR notation
            list($this->lowerInt, $this->upperInt) = $this->parseCidrRange($range);
        } elseif (strpos($range, '-') !== false) {
            // support for IP ranges like '10.0.0.0-10.0.0.255'
            list($this->lowerInt, $this->upperInt) = $this->parseHyphenRange($range);
        } elseif (($pos = strpos($range, '*')) !== false) {
            // support for IP ranges like '10.0.*'
            list($this->lowerInt, $this->upperInt) = $this->parseWildcardRange($range, $pos);
        } else {
            // assume we have a single address
            $this->lowerInt = ip2long($range);
            $this->upperInt = $this->lowerInt;
        }
    }
503372
protected function numToLetter($num, $uppercase = FALSE)
	{
		$num -= 1;

		$letter = 	chr(($num % 26) + 97);
		$letter .= 	(floor($num/26) > 0) ? str_repeat($letter, floor($num/26)) : '';
		return 		($uppercase ? strtoupper($letter) : $letter);
	}
634733
private function getAlphaNumber($number, $lowerCase = false)
    {
        $asciiStartIndex = $lowerCase ? 97 : 65;
        $alpha = '';
        while ($number > 0) {
            $modulus = ($number - 1) % 26;
            $alpha .= chr($modulus + $asciiStartIndex);
            $number = floor(($number - 1) / 26);
        }
        return strrev($alpha);
    }
445215
private function _formatLimit()
    {
        $str = ' LIMIT ';

        if ($this->_skip !== NULL) {
            $str .= $this->_skip;
        }
        if ($this->_skip !== NULL and $this->_limit !== NULL) {
            $str .= ', ';
        }
        if ($this->_limit !== NULL) {
            $str .= $this->_limit;
        }

        return $str;
    }
1061347
public static function lowerAlpha(int $num): string
    {
        $alpha = static::upperAlpha($num);

        return StringHelper::toLowerCase($alpha);
    }
1247192
public static function underscoredToLowerCamelCase($string) {
		$upperCamelCase = str_replace(' ', '', ucwords(str_replace('_', ' ', self::strtolower($string))));
		$lowerCamelCase = self::lcfirst($upperCamelCase);
		return $lowerCamelCase;
	}
268858
function camelCase($pString, $upperCaseFirst = FALSE)
    {
        $regEx = $upperCaseFirst
            ? '/(?:^|-)(.?)/'
            : '/(?:-)(.?)/';

        $filter = function ($p) {
            return \strtoupper($p[1]);
        };

        return \preg_replace_callback($regEx, $filter, $pString);
    }
67321
protected function buildColumnRange(string $lower, string $upper)
    {
        $upper++;
        for ($i = $lower; $i !== $upper; $i++) {
            yield $i;
        }
    }
1238754
public function length($val, $lower, $upper, $id, $name = null) {
        if (strlen($val) < $lower) {
            if (is_null($name))
                $name = ucwords($id);
            $this->add($id, "$name must be at least $lower characters.");
            return false;
        }
        elseif (strlen($val) > $upper) {
            if (is_null($name))
                $name = ucwords($id);
            $this->add($id, "$name cannot be more than $upper characters long.");
            return false;
        }

        return true;
    }
997712
public function toUpperCamelCase($string)
  {
      $string = str_replace(array('-', '_'), ' ', $string);
      $string = ucwords(strtolower($string));
      $string = str_replace(' ', '', $string);

      return $string;
  }
256770
public function upperCaseFirst()
    {
        return $this->cloneInstance(
            function (StringObject $new) {
                $new->string = Mbstring::ucfirst($new->string, $this->encoding);
            }
        );
    }