Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/yockow/swiftstringcomposition

`SwiftStringComposition` provides some features that handles `String` as a collection of lines.
https://github.com/yockow/swiftstringcomposition

Last synced: 24 days ago
JSON representation

`SwiftStringComposition` provides some features that handles `String` as a collection of lines.

Awesome Lists containing this project

README

        

# SwiftStringComposition

`SwiftStringComposition` provides some features that handles `String` as a collection of lines.

# Requirements

- Swift 5.1
- macOS(>=10.15) or Linux

## Dependencies

![Dependencies](./dependencies.svg)

# Usage

```Swift
import StringComposition

let string = """
#include

int main(int argc, char* argv[]) {
printf("Hello, world!");
return 0;
}
"""

var lines = String.Composition(string)
lines.shiftRight(1, in: 3...4)
lines.indent = .spaces(count: 4)

print(lines.description)
/*
#include

int main(int argc, char* argv[]) {
printf("Hello, world!");
return 0;
}
*/

```

# License

MIT License.
See "LICENSE.txt" for more information.