nexuslinkservices/word-wrap-helper

v1.0.0 2016-09-19 14:22 UTC

This package is not auto-updated.

Last update: 2024-09-14 19:20:16 UTC


README

使用字符串换行符将字符串包装到指定字符数。

Latest Version Software License Scrutinizer Code Quality Build Status

安装

如果您使用composer,可以通过运行以下命令添加此包:

composer require galiteintechnologies/word-wrap-helper

使用方法

默认值为 $width = 75, $break = '\n' 和 $cut = false。

<?php

use WordWrapHelper\WordFormatter;

$wordFormatter = new WordFormatter();
        
$content = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.";

$result = $wordFormatter->wrap($content, 30, '-<br/>');

echo $result;

输出

Lorem Ipsum is simply dummy-<br/>text of the printing and-<br/>typesetting industry.

贡献

欢迎提交拉取请求。