Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/purwokertodev/replacer
Remove strange space character as defined by Unicode's White Space property
https://github.com/purwokertodev/replacer
go golang golang-package golang-string whitespace
Last synced: about 2 months ago
JSON representation
Remove strange space character as defined by Unicode's White Space property
- Host: GitHub
- URL: https://github.com/purwokertodev/replacer
- Owner: purwokertodev
- Created: 2018-03-31T05:46:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T15:52:41.000Z (about 6 years ago)
- Last Synced: 2023-07-14T02:39:46.580Z (over 1 year ago)
- Topics: go, golang, golang-package, golang-string, whitespace
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Replacer
Replace space character as defined by Unicode's White Space property (https://golang.org/pkg/unicode/#IsSpace)
[![Build Status](https://travis-ci.org/purwokertodev/replacer.svg?branch=master)](https://travis-ci.org/purwokertodev/replacer) [![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com) [![forthebadge](https://forthebadge.com/images/badges/made-with-go.svg)](https://forthebadge.com)
### Usage
- Install
```shell
go get github.com/purwokertodev/replacer
```
- Example
```go
package mainimport (
"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
}
```