toByteString example

$lines[$i] = $this->styleStack->getCurrent()->apply($line);
            }
        }

        return implode("\n", $lines);
    }

    private function addLineBreaks(string $text, int $width): string
    {
        $encoding = mb_detect_encoding($text, null, true) ?: 'UTF-8';

        return b($text)->toCodePointString($encoding)->wordwrap($width, "\n", true)->toByteString($encoding);
    }
}
$lines[$i] = $this->styleStack->getCurrent()->apply($line);
            }
        }

        return implode("\n", $lines);
    }

    private function addLineBreaks(string $text, int $width): string
    {
        $encoding = mb_detect_encoding($text, null, true) ?: 'UTF-8';

        return b($text)->toCodePointString($encoding)->wordwrap($width, "\n", true)->toByteString($encoding);
    }
}
Home | Imprint | This part of the site doesn't use cookies.