Skip to content

Latest commit

 

History

History
32 lines (23 loc) · 1005 Bytes

README.md

File metadata and controls

32 lines (23 loc) · 1005 Bytes

Replacer

Replace space character as defined by Unicode's White Space property (https://golang.org/pkg/unicode/#IsSpace)

Build Status forthebadge forthebadge

Usage

  • Install
    go get github.com/purwokertodev/replacer
  • Example
    package main
    
    import (
      "fmt"
      "github.com/purwokertodev/replacer"
    )
    
    func main() {
    
      stringWithStrangeSpace := "sometimes i feel \n my heart \t so lonely"
    
      r1 := replacer.Replace(stringWithStrangeSpace, " ")
      r2 := replacer.Replace(stringWithStrangeSpace, "_")
    
      fmt.Println(r1) // sometimes i feel my heart so lonely
      fmt.Println(r2) // sometimes_i_feel_my_heart_so_lonely
    }