/** * Converts each occurrence of some consecutive number of spaces, as * defined by $tabLength, to a tab. By default, each 4 consecutive spaces * are converted to a tab. * * @param int $tabLength Number of spaces to replace with a tab * * @return Stringy Object whose $str has had spaces switched to tabs */ public function toTabs($tabLength = 4) { $spaces = UTF8::str_repeat(' ', $tabLength); $str = UTF8::str_replace($spaces, "\t", $this->str); return static::create($str, $this->encoding); }
public function profileUtf8StrReplace() { UTF8::str_replace("foo", "bar", "foobarfoobar"); }
/** * Replace values in the current array. * * @param string $search The string to replace. * @param string $replacement What to replace it with. * * @return Arrayy (Immutable) */ public function replaceValues($search, $replacement = '') { $array = $this->each(function ($value) use($search, $replacement) { return UTF8::str_replace($search, $replacement, $value); }); return $array; }