• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.travis.ymlH A D03-Dec-2018389 1915

CHANGELOG.mdH A D03-Dec-2018139 95

README.mdH A D03-Dec-20182.9 KiB7147

appveyor.ymlH A D03-Dec-2018255 2214

cryptorandomstringutils.goH A D03-Dec-20187.9 KiB252120

cryptorandomstringutils_test.goH A D03-Dec-20182.8 KiB7755

randomstringutils.goH A D03-Dec-20189 KiB269114

randomstringutils_test.goH A D03-Dec-20182.5 KiB7945

stringutils.goH A D03-Dec-20185.9 KiB225110

stringutils_test.goH A D03-Dec-20185.7 KiB310191

wordutils.goH A D03-Dec-20189.6 KiB358176

wordutils_test.goH A D03-Dec-20186.6 KiB284179

README.md

1GoUtils
2===========
3[![Stability: Maintenance](https://masterminds.github.io/stability/maintenance.svg)](https://masterminds.github.io/stability/maintenance.html)
4[![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils) [![Build Status](https://travis-ci.org/Masterminds/goutils.svg?branch=master)](https://travis-ci.org/Masterminds/goutils) [![Build status](https://ci.appveyor.com/api/projects/status/sc2b1ew0m7f0aiju?svg=true)](https://ci.appveyor.com/project/mattfarina/goutils)
5
6
7GoUtils provides users with utility functions to manipulate strings in various ways. It is a Go implementation of some
8string manipulation libraries of Java Apache Commons. GoUtils includes the following Java Apache Commons classes:
9* WordUtils
10* RandomStringUtils
11* StringUtils (partial implementation)
12
13## Installation
14If you have Go set up on your system, from the GOPATH directory within the command line/terminal, enter this:
15
16	go get github.com/Masterminds/goutils
17
18If you do not have Go set up on your system, please follow the [Go installation directions from the documenation](http://golang.org/doc/install), and then follow the instructions above to install GoUtils.
19
20
21## Documentation
22GoUtils doc is available here: [![GoDoc](https://godoc.org/github.com/Masterminds/goutils?status.png)](https://godoc.org/github.com/Masterminds/goutils)
23
24
25## Usage
26The 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).
27
28    package main
29
30    import (
31        "fmt"
32    	"github.com/Masterminds/goutils"
33    )
34
35    func main() {
36
37    	// EXAMPLE 1: A goutils function which returns no errors
38        fmt.Println (goutils.Initials("John Doe Foo")) // Prints out "JDF"
39
40    }
41Some 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).
42
43    package main
44
45    import (
46        "fmt"
47        "github.com/Masterminds/goutils"
48    )
49
50    func main() {
51
52        // EXAMPLE 2: A goutils function which returns an error
53        rand1, err1 := goutils.Random (-1, 0, 0, true, true)
54
55        if err1 != nil {
56			fmt.Println(err1) // Prints out error message because -1 was entered as the first parameter in goutils.Random(...)
57		} else {
58			fmt.Println(rand1)
59		}
60
61    }
62
63## License
64GoUtils 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.
65
66## Issue Reporting
67Make suggestions or report issues using the Git issue tracker: https://github.com/Masterminds/goutils/issues
68
69## Website
70* [GoUtils webpage](http://Masterminds.github.io/goutils/)
71