/** * 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); }