@param string $string
@param bool   $cutIndents Function Strings::normalizeIndents will be applied.

@return self
482737
public function setString(string $string, bool $cutIndents = false): Source
    {
        return $this->setLines($this->fetchLines($string, $cutIndents));
    }
739887
public function concat($string, $prepend = false)
    {
        $this->string = $prepend ? (string) $string . $this->string : $this->string . (string) $string;

        return $this;
    }
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);
    }
655693
protected function manipulate($string)
    {
        $chunks = $this->getKeysFromString($string);
        $array = $this->getArray();

        return $this->formatArray($array, $chunks);
    }
908290
public static function endsWith($string, $substrings)
    {
        if (is_array($substrings)) {
            foreach ((array) $substrings as $substring) {
                if ((string) $substring === static::subString($string, -static::length($substring))) {
                    return true;
                }
            }
        } elseif (is_string($substrings)) {
            if ((string) $substring === static::subString($string, -static::length($substring))) {
                return true;
            }
        }

        return false;
    }
944127
public function setAddString(string $string): ButtonInterface
    {
        if ($this->isVisibility()) {
            $this->strings[] = $string;
        }

        return $this;
    }
762860
public static function singular($string)
    {
        $result = $string;
        foreach (self::$_singular as $rule => $replacement) {
            $rule = self::_normalize($rule);
            if (preg_match($rule, $string)) {
                $result = preg_replace($rule, $replacement, $string);
                break;
            }
        }
        return $result;
    }
329960
public function deleteLeading($string)
    {
        $this->value = Character::deleteLeading($string, $this->value);

        return $this;
    }
331233
public static function indentLines($text, $indent, $skipFirstLine = false)
    {
        $lines = explode(PHP_EOL, $text);

        // (つ◕.◕)つ━☆ﾟ.*･｡ﾟ
        !$skipFirstLine || $preparedLines[] = array_shift($lines);

        foreach ($lines as $line) {
            $preparedLines[] = self::indent($indent) . rtrim($line);
        }

        return implode(PHP_EOL, $preparedLines);
    }
1359417
public function append(string $string): self
    {
        return new self((string) $this.$string, $this->encoding);
    }
688728
public static function slugify($string) {
        $string = strip_tags($string);
        $string = str_replace(['&amp;', '&'], 'and', $string);
        $string = str_replace('@', 'at', $string);

        // @codeCoverageIgnoreStart
        if (class_exists('Titon\G11n\Utility\Inflector')) {
            return \Titon\G11n\Utility\Inflector::slug($string);
        }
        // @codeCoverageIgnoreEnd

        return Inflector::slug($string);
    }
612918
function indent(string, indent) {
    return string.split('\n').map(function (line) {
        return indent + line;
    }).join('\n');
}
524634
public function appendF ($string)
	{
		ensure('Argument', $string, 'is_a_string', __CLASS__, __METHOD__);

		if ($string instanceof self) {
			$string = $string->to_s();
		}

		$this->string .= $string;

		return $this;
	}
1201625
public static function fromString($string)
    {
        if (preg_match(self::PATTERN_FROM_STRING, trim($string), $matches)) {
            if (2 === count($matches)) {
                // whole number
                return new self((int) $matches[1]);
            } else {
                // either x y/z or x/y
                if ($matches[2]) {
                    // x y/z
                    $whole = new self((int) $matches[1]);

                    return $whole->add(new self(
                        (int) $matches[2],
                        (int) $matches[3]
                    ));
                }

                // x/y
                return new self((int) $matches[1], (int) $matches[3]);
            }
        }

        throw new InvalidArgumentException(sprintf(
            'Cannot parse "%s"',
            $string
        ));
    }
793927
private static function applyTransliterations($string)
    {
        // Apply the straight transliterations with strtr as it's much faster
        $string = strtr($string, self::$_transliterations['straight']);

        // Apply the regex rules over the resulting $string
        return preg_replace(
            array_keys(self::$_transliterations['regexp']),
            array_values(self::$_transliterations['regexp']),
            $string
        );
    }
378939
public static function makeByString($string)
    {
        $fg = $bg = '';
        $extra = false;
        $options = [];
        $parts = \explode(';', \str_replace(' ', '', $string));

        foreach ($parts as $part) {
            $subParts = \explode('=', $part);

            if (\count($subParts) < 2) {
                continue;
            }

            switch ($subParts[0]) {
                case 'fg':
                    $fg = $subParts[1];
                    break;
                case 'bg':
                    $bg = $subParts[1];
                    break;
                case 'extra':
                    $extra = (bool)$subParts[1];
                    break;
                case 'options':
                    $options = \explode(',', $subParts[1]);
                    break;
                default:
                    throw new \RuntimeException('Invalid option');
                    break;
            }
        }

        return new self($fg, $bg, $options, $extra);
    }
765990
function indent($str, $output = true) {
    if ($this->parser->isStartTag) {
      $this->indent .= $str;
      if ($output) {
        $this->out($str, true);
      }
    } else {
      $this->indent = substr($this->indent, 0, -strlen($str));
    }
  }