https://github.com/goblindegook/delimiter-align
Aligns and rebalances multiline strings around a delimiter.
https://github.com/goblindegook/delimiter-align
Last synced: 2 months ago
JSON representation
Aligns and rebalances multiline strings around a delimiter.
- Host: GitHub
- URL: https://github.com/goblindegook/delimiter-align
- Owner: goblindegook
- License: gpl-2.0
- Created: 2015-08-08T01:49:31.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-10T02:03:29.000Z (over 9 years ago)
- Last Synced: 2024-11-20T17:07:24.657Z (7 months ago)
- Language: PHP
- Size: 160 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# goblindegook/delimiter-align [](https://travis-ci.org/goblindegook/delimiter-align)
Aligns and rebalances plain text multiline strings around a delimiter.
In short, it turns this:
```
one: 1
two: 2
three: 3
```into this:
```
one: 1
two: 2
three: 3
```## Installation
Install using Composer by running the following in your project directory:
```
$ composer require goblindegook/delimiter-align
```## Description
```php
string delimiter_align ( string $string [, string $delimiter ] [, array $options ] );
```Aligns and rebalances plain text multiline strings around a delimiter.
### Parameters
#### `string`
Multiline string to align.#### `delimiter`
Boundary string to align around. (Optional, defaults to `:`.)#### `options`
Alignment options:| Option | Description | Default |
| :------- | :-------------------------------------------------- | :------ |
| `before` | String prepended to the padded delimiter. | (empty) |
| `after` | String appended to the padded delimiter. | `' '` |
| `pad` | Padding character. | `' '` |
| `right` | Align the delimiter by placing padding on the left. | `false` |### Return Value
Returns the `string` aligned around the provided `delimiter`.