Coder Social home page Coder Social logo

matribots / go-swiss-knife Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 8 KB

Just like a swiss knife - A simple go utility toolkits which is used for general purpose during daily coding.

License: BSD 3-Clause "New" or "Revised" License

Go 100.00%
go golang swiss-knife swissknife toolkit utility utility-library

go-swiss-knife's Introduction

go-swiss-knife

Go Reference

Just like a swiss knife - A simple go utility toolkits which is used for general purpose during daily coding.

Char&String Knives

Locate in charstring package. This package is mainly used for dealing with strings and chars misc stuffs.

Here is the example:

package main

import "github.com/matribots/go-swiss-knife/charstring"

// you must defined ascii type first
type ascii byte

func main() {
    var len = 20
    asciiChars := make([]ascii, len)

    // Generate 20 random printable ascii chars that locate in [28,125)
    charstring.RandomPrintableASCII(28, 125, len)


    // Check if a string is empty
    str1, str2, str3, str4 :="", "    ", "NOT_EMPTY", "NOT EMPTY"
    // str1 is empty
    charstring.IsEmptyString(str1)
    // str2 is empty
    charstring.IsEmptyString(str2)
    // str3 is not empty
    charstring.IsEmptyString(str3)
    // str4 is not empty
    charstring.IsEmptyString(str4)
}

Crypto Knives

Locate in crypto package. This package is mainly used for dealing password, encryption and decryption miscs.

Here is the example:

package main

import "github.com/matribots/go-swiss-knife/crypto"

func main(){
    // Generate a random strong password that length is 20.
    crypto.RandomPassword(20)    
}

Numbers Knives

Locate in numbers package. This package is mainly used for dealing numbers related miscs.

Here is the example:

package main

import "github.com/matribots/go-swiss-knife/numbers"

func main(){
    // Generate a random postive int that locate in [0,80).
    numbers.RandomPostiveInt(80)
    // Generate 20 random postive ints that locate in [0,100).
    numbers.RandomPostiveInts(0, 100, 20)
}

go-swiss-knife's People

Contributors

matribots 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.