Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/plugfox/multiline

Provides convenient access to multiline String records with method extensions.
https://github.com/plugfox/multiline

coverage multiline pipeline symbols wtfpl

Last synced: 3 months ago
JSON representation

Provides convenient access to multiline String records with method extensions.

Awesome Lists containing this project

README

        

# multiline

![](https://github.com/PlugFox/multiline/raw/master/.img/logo.png)

[![Actions Status](https://github.com/PlugFox/multiline/workflows/multiline/badge.svg)](https://github.com/PlugFox/multiline/actions)
[![Coverage](https://codecov.io/gh/PlugFox/multiline/branch/master/graph/badge.svg)](https://codecov.io/gh/PlugFox/multiline)
[![Pub](https://img.shields.io/pub/v/multiline.svg)](https://pub.dev/packages/multiline)
[![Code size](https://img.shields.io/github/languages/code-size/plugfox/multiline?logo=github&logoColor=white)](https://github.com/plugfox/multiline)
[![License: WTFPL](https://img.shields.io/badge/License-WTFPL-brightgreen.svg)](https://en.wikipedia.org/wiki/WTFPL)
[![effective_dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart)
[![GitHub stars](https://img.shields.io/github/stars/PlugFox/multiline?style=social)](https://github.com/PlugFox/multiline/)


## About

Provides convenient access to multiline String records with method extensions.
Useful for templates, mockups and SQL queries.

Just use the symbol "`|`" to indicate the beginning of a line.
Beautiful code formatting using some useful extensions to the String methods.

Available method extensions:

+ `multiline()` - return formatted with pipeline symbol "`|`" `String`.

+ `multilineSplit()` - splits the string and returns a `Iterable` of substrings.

You can use custom "pipeline" and "join" symbols.


## For example

```dart
import 'package:multiline/multiline.dart'; // <= import package

void main() {
/// Return formatted with pipeline symbol "`|`" [String].
final string =
'''
|/*
| * List of books and the number of
| * authors associated with each book
| */
|SELECT
| `books`.`title` AS `Title`,
| count(*) AS `Authors`
|FROM `books`
|JOIN `authors`
| ON `books`.`isbn` = `authors`.`isbn`
|GROUP BY
| `books`.`title`
|ORDER BY
| `books`.`title` ASC
|;
'''.multiline();
print(string);

/// Splits the string and returns a [Iterable] of substrings.
final iterable =
'''
| * One
| * Two
| * Three
'''.multilineSplit();
iterable.forEach(print);
}
```


## Coverage

[![](https://codecov.io/gh/PlugFox/multiline/branch/master/graphs/sunburst.svg)](https://codecov.io/gh/PlugFox/multiline/branch/master)


## Changelog

Refer to the [Changelog](https://github.com/plugfox/multiline/blob/master/CHANGELOG.md) to get all release notes.


## Maintainers

[Plague Fox](https://plugfox.dev)


## License

[WTFPL](https://github.com/plugfox/multiline/blob/master/LICENSE)