Git Product home page Git Product logo

ffmt's Introduction

Friendly data formatting for golang

Install

go get -u -v gopkg.in/ffmt.v1

Usage

API Documentation

Examples

package main

import (
	ffmt "gopkg.in/ffmt.v1"
)

func main() {
	example()
}

func example() {
	m := map[string]interface{}{
		"hello": "w",
		"A": []int{
			1, 2, 3, 4, 5, 6,
		},
	}

	ffmt.Puts(m)
	/*
	   {
	    "A": [
	     1 2 3
	     4 5 6
	    ]
	    "hello": "w"
	   }
	*/

	ffmt.P(m)
	/*
	   map{
	    string(A): slice[
	     int(1) int(2) int(3)
	     int(4) int(5) int(6)
	    ]
	    string(hello): string(w)
	   }
	*/

	ffmt.Pjson(m)
	/*
	   {
	    "A": [
	     1,2,3
	    ,4,5,6
	    ]
	   ,"hello": "w"
	   }
	*/

	m0 := ffmt.ToTable(m, m)
	ffmt.Puts(m0)
	/*
	   [
	    [
	     "A"
	     "hello"
	    ]
	    [
	     "[1 2 3 4 5 6]"
	     "w"
	    ]
	   ]
	*/

	m1 := ffmt.FmtTable(m0)
	ffmt.Puts(m1)
	/*
	   [
	    "A             hello "
	    "[1 2 3 4 5 6] w     "
	   ]
	*/

	ffmt.Mark("hello")
	/*
	   main.go:76  hello
	*/
}

MIT License

Copyright © 2017-2018 wzshiming<https://github.com/wzshiming>.

MIT is open-sourced software licensed under the MIT License.

ffmt's People

Contributors

wzshiming avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.