golang 更友好的格式化输出 ffmt
- 授权协议: MIT
- 开发语言: Google Go
- 操作系统: 跨平台
- 软件首页: https://github.com/go-ffmt/ffmt
- 软件文档: https://github.com/go-ffmt/ffmt
- 官方下载: https://github.com/go-ffmt/ffmt
软件介绍
安装
go get -u -v gopkg.in/ffmt.v1
用法
package main
import (
ffmt "gopkg.in/ffmt.v1"
)
func main() {
example()
}
func example() {
m := struct {
String string
Int int
Slice []int
Map map[string]interface{}
}{
"hello world",
100,
[]int{1, 2, 3, 4, 5, 6},
map[string]interface{}{
"A": 123,
"BB": 456,
},
}
fmt.Println(m) // fmt 默认输出
/*
{hello world 100 [1 2 3 4 5 6] map[BB:456 A:123]}
*/
ffmt.Puts(m) // 较为友好的输出
/*
{
String: "hello world"
Int: 100
Slice: [
1 2 3
4 5 6
]
Map: {
"A": 123
"BB": 456
}
}
*/
ffmt.Print(m) // 同 Puts 但是字符串不加引号
/*
{
String: hello world
Int: 100
Slice: [
1 2 3
4 5 6
]
Map: {
A: 123
BB: 456
}
}
*/
ffmt.P(m) // 友好格式化加上类型
/*
struct{
String: string(hello world)
Int: int(100)
Slice: slice[
int(1) int(2) int(3)
int(4) int(5) int(6)
]
Map: map{
string(A): int(123)
string(BB): int(456)
}
}
*/
ffmt.Pjson(m) // 以 json 风格输出
/*
{
"Int": 100
,"Map": {
"A": 123
,"BB": 456
}
,"Slice": [
1,2,3
,4,5,6
]
,"String": "hello world"
}
*/
m0 := ffmt.ToTable(m, m) // 按字段拆成表
ffmt.Puts(m0)
/*
[
[
"String" "Int"
"Slice" "Map"
]
[
"hello world" "100"
"[1 2 3 4 5 6]" "map[A:123 BB:456]"
]
]
*/
m1 := ffmt.FmtTable(m0) // [][]string 表格式化
ffmt.Puts(m1)
/*
[
"String Int Slice Map "
"hello world 100 [1 2 3 4 5 6] map[A:123 BB:456] "
]
*/
ffmt.Mark("hello") // 标记输出位置
/*
main.go:122 hello
*/
}
细节决定交互设计的成败
张亮 / 2009-3 / 49.00元
《细节决定交互设计的成败》是一本非常实用的有关软件界面的交互设计和可用性设计方面知识的书籍,通过采用一问一答的形式,你将会有针对性地学习到一些能够很快应用在自己软件开发工作中的细节知识和诀窍。例如,如何减轻用户的等待感,如何预防和减少用户的使用错误等。另外,你会发现阅读《细节决定交互设计的成败》时会非常轻松和愉悦;这是由于《细节决定交互设计的成败》写作上的两个特点:第一,采用较多日常生活中的例子来......一起来看看 《细节决定交互设计的成败》 这本书的介绍吧!
