wikimedia / wrappedstring
Automatically compact sequentially-outputted strings that share a common prefix / suffix pair.
v4.0.1
2021-08-04 23:56 UTC
Requires
- php: >=7.2.9
Requires (Dev)
- mediawiki/mediawiki-codesniffer: 37.0.0
- mediawiki/mediawiki-phan-config: 0.10.6
- mediawiki/minus-x: 1.1.1
- ockcyp/covers-validator: 1.3.3
- php-parallel-lint/php-console-highlighter: 0.5.0
- php-parallel-lint/php-parallel-lint: 1.3.0
- phpunit/phpunit: ^8.5
README
WrappedString is a small PHP library for compacting redundant string-wrapping code in text output. The most common use-case is to eliminate redundant runs of HTML open/close tags and JavaScript boilerplate.
Here is how you use it:
use Wikimedia\WrappedString; $buffer = [ new WrappedString( '[foo]', '[', ']' ), new WrappedString( '[bar]', '[', ']' ), ]; $output = WrappedString::join( "\n", $buffer ); // Result: '[foobar]'
License
The project is licensed under the MIT license.