Skip to content

A set of chain-able string helpers to reduce the pain of manipulating strings

License

Notifications You must be signed in to change notification settings

mamal72/stringish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Go Report Card GoDoc license

stringish

A set of chain-able string helpers to reduce the pain of manipulating strings.

Installation

go get github.com/mamal72/stringish
# or use dep, vgo, glide or anything else

Usage

Implemented Methods

  • ReplaceN
  • ReplaceAll
  • ToLower
  • ToUpper
  • TrimPrefix
  • TrimSuffix
  • TrimSpaces
  • TrimPrefixSpaces
  • TrimSuffixSpaces
  • HasPrefix
  • HasSuffix
  • Equals
  • IsEmpty
  • IsBlank
  • Contains
  • Len
  • Index
  • LastIndex
  • Map
  • Filter
  • GetString

Example

package main

import (
	"log"

	"github.com/mamal72/stringish"
)

func main() {
	str := stringish.New("  hello there ")
	str.TrimSpaces().Map(func(char string) string {
		return strings.ToUpper(char)
	})
	log.Println(str.GetString()) // "HELLO THERE"
	log.Println(str.Replace("HELLO", "bye").Contains("bye")) // true
	log.Println(str.GetString()) // "bye THERE"
}

Ideas || Issues

Just create an issue and describe it. I'll check it ASAP!

Contribution

You can fork the repository, improve or fix some part of it and then send the pull requests back (with some tests ofc) if you want to see them here. I really appreciate that. ❤️

About

A set of chain-able string helpers to reduce the pain of manipulating strings

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages