Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/syohex/go-texttable
go-texttable provides creating text table
https://github.com/syohex/go-texttable
Last synced: about 2 months ago
JSON representation
go-texttable provides creating text table
- Host: GitHub
- URL: https://github.com/syohex/go-texttable
- Owner: syohex
- License: mit
- Created: 2013-07-09T13:10:07.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2020-09-19T02:43:42.000Z (over 4 years ago)
- Last Synced: 2024-06-19T00:35:07.122Z (7 months ago)
- Language: Go
- Size: 102 KB
- Stars: 20
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-texttable ![](https://github.com/syohex/go-texttable/workflows/CI/badge.svg)
## Sample Code
```go
package mainimport "github.com/syohex/go-texttable"
import "fmt"func main () {
tbl := &texttable.TextTable{}
tbl.SetHeader("Country", "Capital")tbl.AddRow("United States of America", "Washington D.C")
tbl.AddRow("France", "Paris")
tbl.AddRow("United Kingdom", "London")
tbl.AddRow("Japan", "Tokyo")
tbl.AddRow("Taiwan", "Taipei")fmt.Println(tbl.Draw())
}```
Output of above code is
![go-texttable1](image/go-texttable1.png)
`go-texttable` also supports multibyte characters such as Japanese.
```go
package mainimport "github.com/syohex/go-texttable"
import "fmt"func main () {
tbl := &texttable.TextTable{}
tbl.SetHeader("プログラミング言語", "よみがな", "作者")tbl.AddRow("Python", "ぱいそん", "グイド・ヴァンロッサム")
tbl.AddRow("Perl", "ぱーる", "ラリーウォール")
tbl.AddRow("Ruby", "るびぃ", "まつもとゆきひろ")
tbl.AddRow("Erlang", "あーらん", "ジョーアームストロング")
tbl.AddRow("D言語", "でぃーげんご", "ウォルター・ブライト")fmt.Println(tbl.Draw())
}
```![go-texttable2](image/go-texttable2.png)