goutils

GoUtils is a Go implementation of some string manipulation libraries of Apache Commons. This is an open source project aimed at providing Go users with utility functions to manipulate strings in various ways.

  • 所有者: Masterminds/goutils
  • 平台:
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

GoUtils

Stability: Maintenance
GoDoc Build Status Build status

GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some
string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes:

  • WordUtils
  • RandomStringUtils
  • StringUtils (partial implementation)

Installation

If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this:

go get github.com/Masterminds/goutils

If you do not have Go set up on your system, please follow the Go installation directions from the documenation, and then follow the instructions above to install GoUtils.

Documentation

GoUtils doc is available here: GoDoc

Usage

The code snippets below show examples of how to use GoUtils. Some functions return errors while others do not. The first instance below, which does not return an error, is the Initials function (located within the wordutils.go file).

package main

import (
    "fmt"
	"github.com/Masterminds/goutils"
)

func main() {

	// EXAMPLE 1: A goutils function which returns no errors
    fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF"

}

Some functions return errors mainly due to illegal arguements used as parameters. The code example below illustrates how to deal with function that returns an error. In this instance, the function is the Random function (located within the randomstringutils.go file).

package main

import (
    "fmt"
    "github.com/Masterminds/goutils"
)

func main() {

    // EXAMPLE 2: A goutils function which returns an error
    rand1, err1 := goutils.Random (-1, 0, 0, true, true)  

    if err1 != nil {
		fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...)
	} else {
		fmt.Println(rand1)
	}

}

License

GoUtils is licensed under the Apache License, Version 2.0. Please check the LICENSE.txt file or visit http://www.apache.org/licenses/LICENSE-2.0 for a copy of the license.

Issue Reporting

Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues

Website

主要指標

概覽
名稱與所有者Masterminds/goutils
主編程語言Go
編程語言Go (語言數: 1)
平台
許可證Apache License 2.0
所有者活动
創建於2014-03-06 22:02:45
推送於2021-02-04 20:16:33
最后一次提交2021-02-04 13:06:53
發布數4
最新版本名稱v1.1.1 (發布於 )
第一版名稱1.0.0 (發布於 )
用户参与
星數98
關注者數8
派生數26
提交數58
已啟用問題?
問題數23
打開的問題數2
拉請求數8
打開的拉請求數2
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?