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
*/
}
数据结构与算法分析
(美)(C.A.谢弗)Clifford A.Shaffer / 电子工业出版社 / 1998-8 / 35.00元
本书综合“数据结构与算法”的知识梳理、习题解答及上机辅导等于一身;精心挑选了覆盖教学大纲的五百多道题目,并且提供所有题目的参考答案;对于较难的算法和上机题,给出了详细的分析和说明;对于学习的重点和难点、易犯的错误、题目的难易和重要性,以及国内教材的差异等都给出了必要的说明。 本书可给使用各种教材讲授和学习“数据结构与算法”(或者“数据结构”)的师生参考,是系统复习该课程和准备应考计算......一起来看看 《数据结构与算法分析》 这本书的介绍吧!
