Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghosind/formatparser
Parse format strings.
https://github.com/ghosind/formatparser
formatter parser
Last synced: 9 days ago
JSON representation
Parse format strings.
- Host: GitHub
- URL: https://github.com/ghosind/formatparser
- Owner: ghosind
- License: mit
- Created: 2022-02-26T15:23:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-02-26T16:34:16.000Z (over 2 years ago)
- Last Synced: 2024-06-20T02:05:43.869Z (5 months ago)
- Topics: formatter, parser
- Language: Go
- Homepage: https://pkg.go.dev/github.com/ghosind/formatparser
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# formatparser
![test](https://github.com/ghosind/formatparser/workflows/Test/badge.svg)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/79fba4a6e6084cc8b5755450e7bff9ef)](https://www.codacy.com/gh/ghosind/formatparser/dashboard?utm_source=github.com&utm_medium=referral&utm_content=ghosind/formatparser&utm_campaign=Badge_Grade)
![Version Badge](https://img.shields.io/github/v/release/ghosind/formatparser)
![License Badge](https://img.shields.io/github/license/ghosind/formatparser)
[![Go Reference](https://pkg.go.dev/badge/github.com/ghosind/formatparser.svg)](https://pkg.go.dev/github.com/ghosind/formatparser)Parse format string to text token part or key token part arrays.
## Installation
```sh
go get -u github.com/ghosind/formatparser
```## Getting Started
```go
package mainimport (
"log""github.com/ghosind/formatparser"
)func main() {
format := "[%time] %message"parts := formatparser.Parse(format)
for _, part := range parts {
log.Println(part)
}
}
``````sh
$ go run app.go
&{1 [}
&{2 time}
&{1 ] }
&{2 %message}
```