Separa uma string.

@param  string $string
@param  int    $posicaoInicial
@param  int    $posicaoFinal   default null
@return string
340868
public function separaString($string, $posicaoInicial, $posicaoFinal = null)
    {
        if ($posicaoFinal == null) {
            return substr($string, $posicaoInicial - 1);
        }

        return substr($string, $posicaoInicial - 1, ($posicaoFinal - 1) * (-1));
    }
1205768
public function pegaPosStringDeterminada($string, $stringBusca)
    {
        $tamanhoStrBusca = strlen($stringBusca);
     
        return stripos($string, $stringBusca) + $tamanhoStrBusca + 1;
    }
983044
public static function lastIn(?string $string, ?string $delimiter, bool $withoutDelimiter = false): ?string
    {
        if (self::likeEmpty($string) || self::likeEmpty($delimiter)) {
            return null;
        }

        $pos = mb_strrpos($string, $delimiter);
        // if entry is not founded return false
        if (!Any::isInt($pos)) {
            return null;
        }

        // remove delimiter pointer
        if ($withoutDelimiter) {
            $pos++;
        }

        return self::sub($string, $pos);
    }
1235430
static function Trim($string, $chars = null)
    {
        self::InitEncoding();
        if (!$chars)
            return trim($string);

        return trim($string, $chars);
    }
205940
protected function getSubstringBetweenParentheses(string $string): string
    {
        $startingPosition = 0;
        $openParentheses = 0;
        $substring = '';

        $length = strlen($string);
        for ($i = $startingPosition; $i < $length; $i++) {
            if ($string[$i] === ')') {
                $openParentheses--;
            }
            if ($openParentheses > 0) {
                $substring .= $string{$i};
            }
            if ($string[$i] === '(') {
                $openParentheses++;
            }
        }
        if ($openParentheses < 0) {
            throw new InvalidPointcutExpressionException('Pointcut expression is in excess of ' . abs($openParentheses) . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966689);
        }
        if ($openParentheses > 0) {
            throw new InvalidPointcutExpressionException('Pointcut expression lacks of ' . $openParentheses . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966690);
        }
        return $substring;
    }
1054896
public static function substring($string, $start = 0, $length = null)
    {
        if (!self::isValid($string)) {
            return false;
        }

        return mb_substr($string, $start, $length);
    }
827219
public static function padRight(
        $string,
        $length = 0,
        $substring = ' ',
        $encoding = null
    ) {
        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        return static::doPad($string, 0, $length - Mbstring::strlen($string, $encoding), $substring, $encoding);
    }
1286043
public static function part(string $string, string $separator, int $index, string $defaultValue = ''): string
    {
        if ($string !== '') {
            $string = explode($separator, $string);
            if (isset($string[$index])) {
                return $string[$index];
            }
        }
        return $defaultValue;
    }
519839
protected function sensible($string)
    {
        $string = preg_replace('`([A-Z])`', '-\1', $string);
        $string = str_replace(array('-', '_'), ' ', $string);

        return ucfirst(trim(strtolower($string)));
    }
493533
public function prompt($string, $default = null) {
        if ($default !== null) {
            $suffix = (string) $default;
            $question = "<question>$string</question> [<yellow>$suffix</yellow>]: ";
        } else {
            $question = "<question>$string</question>: ";
        }

        $this->output->write($question);
        $input = $this->input->readLine();

        if (strlen($input) == 0) {
            $input = $default;
        }

        if ($input === null) {
            return $this->prompt($string, $default);
        }

        return $input;
    }
336731
public function loadString($string)
    {
        $this->string = htmlspecialchars_decode($string);

        return (bool)empty($this->string);
    }
1068252
public function write($string)
    {
        $length = strlen($string);

        $start = substr($this->resource, 0, $this->pointer);
        $end = substr($this->resource, $this->pointer + $length);

        $this->resource = $start . $string . $end;

        $this->pointer = strlen($start . $string);

        return $string;
    }
927949
public static function ucFirst($string)
    {
        $ucFirst = static::sub($string, 0, 1);
        $ucFirst = static::upp($ucFirst);

        return $ucFirst . static::sub($string, 1);
    }
613088
public static function substring($string, $startpos, $endpos = -1)
    {
        $len = strlen($string);
        $endpos = (int) (($endpos === -1) ? $len - 1 : $endpos);
        if ($startpos > $len - 1 || $startpos < 0) {
            trigger_error("substring(), Startindex out of bounds must be 0<n<$len", E_USER_ERROR);
        }
        if ($endpos > $len - 1 || $endpos < $startpos) {
            trigger_error("substring(), Endindex out of bounds must be $startpos<n<" . ($len - 1), E_USER_ERROR);
        }
        if ($startpos === $endpos) {
            return (string) $string{$startpos};
        } else {
            $len = $endpos - $startpos;
        }

        return substr($string, $startpos, $len + 1);
    }
524038
public function slug($entity, $string = null, $separator = null)
    {
        if ($separator === null) {
            $separator = $this->getConfig('separator');
        }

        if (is_string($entity)) {
            if ($string !== null) {
                $separator = $string;
            }
            $string = $entity;
            unset($entity);
        } elseif (($entity instanceof Entity) && $string === null) {
            $string = $this->_getSlugStringFromEntity($entity, $separator);
        }

        $slug = $this->_slug($string, $separator);

        $unique = $this->getConfig('unique');
        if (isset($entity) && $unique) {
            $slug = $unique($entity, $slug, $separator);
        }

        return $slug;
    }
757331
public static function last($string, $length = 1, $encoding = null)
    {
        if ($string === '' || $length <= 0) {
            return '';
        }

        $encoding = $encoding === null ? mb_internal_encoding() : $encoding;

        return Mbstring::substr($string, -$length, null, $encoding);
    }
1301565
public static function fromString($string, $default=true)
    {
        $array = array();

        foreach (preg_split('/\s+/', $string, -1, PREG_SPLIT_NO_EMPTY) as $token) {
            $fragments = explode("=", $token);
            $value = isset($fragments[1])
                ? trim($fragments[1],"' ") : $default;

            $array[$fragments[0]] = $value === 'null'
                ? null : $value;
        }

        return new self($array, $default);
    }