ut

package module
v0.0.0-...-3b4caac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2018 License: MIT Imports: 7 Imported by: 0

README

ut

Build Status codecov GoDoc

The missing utility library for Go.

Installation

go get github.com/iawia002/ut

Usage

package main

import (
	"fmt"

	"github.com/iawia002/ut"
)

func main() {
	fmt.Println(ut.Reverse("54321")) // 12345
}

Examples

gore> :import github.com/iawia002/ut
gore> ut.Reverse("12345")
"54321"
gore> ut.Range(0, 5)
[]int{0, 1, 2, 3, 4, 5}
gore> ut.TrimSpace("1 2\n3\t45")
"12345"
gore> ut.Domain("hello.com")
"hello"
gore> ut.ItemInSlice("a", []string{"a", "b", "c"})
true
gore> ut.Md5("123")
"202cb962ac59075b964b07152d234b70"

Documentation

Overview

Package ut is a Go utility library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Domain

func Domain(url string) string

Domain get the domain of given URL.

func FileSize

func FileSize(filePath string) (int64, bool)

FileSize returns the file size of the specified path file.

func ItemInSlice

func ItemInSlice(item, list interface{}) bool

ItemInSlice if a item is in the list.

func LimitLength

func LimitLength(s string, length int, ellipses string) string

LimitLength limit the maximum length of the string.

func MatchAll

func MatchAll(text, pattern string) [][]string

MatchAll returns all matching results.

func MatchOneOf

func MatchOneOf(text string, patterns ...string) []string

MatchOneOf match one of the patterns.

func Md5

func Md5(text string) string

Md5 returns the MD5 checksum of the data.

func Range

func Range(min, max int) []int

Range generate a sequence of numbers by range.

func Reverse

func Reverse(s string) string

Reverse reverse a string.

func TrimSpace

func TrimSpace(str string) string

TrimSpace remove all spaces in the string.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL