Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trubitsyn/go-zero-width
Zero-width character detection and removal for Go
https://github.com/trubitsyn/go-zero-width
golang zero-width zero-width-space
Last synced: about 2 months ago
JSON representation
Zero-width character detection and removal for Go
- Host: GitHub
- URL: https://github.com/trubitsyn/go-zero-width
- Owner: trubitsyn
- License: apache-2.0
- Archived: true
- Created: 2018-06-18T13:55:09.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-06T14:29:12.000Z (over 4 years ago)
- Last Synced: 2024-07-31T20:53:13.943Z (5 months ago)
- Topics: golang, zero-width, zero-width-space
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 109
- Watchers: 2
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - go-zero-width - Zero-width character detection and removal for Go. (Text Processing / Utility/Miscellaneous)
- awesome-go-extra - ARCHIVED - width character detection and removal for Go|103|9|0|2018-06-18T13:55:09Z|2020-08-06T14:29:12Z| (Bot Building / Utility/Miscellaneous)
README
# go-zero-width [![Mentioned in Awesome Go](https://awesome.re/mentioned-badge.svg)](https://github.com/avelino/awesome-go) [![Golang Weekly #241](https://img.shields.io/badge/Golang%20Weekly-%23241-2CB3E5.svg)](https://golangweekly.com/issues/241) [![Golang Weekly #241](https://img.shields.io/badge/Golang%20Weekly-%23295-2CB3E5.svg)](https://golangweekly.com/issues/295) [![Build Status](https://travis-ci.org/trubitsyn/go-zero-width.svg?branch=master)](https://travis-ci.org/trubitsyn/go-zero-width) [![GoDoc](https://godoc.org/github.com/trubitsyn/go-zero-width?status.svg)](https://godoc.org/github.com/trubitsyn/go-zero-width) [![Go Report Card](https://goreportcard.com/badge/github.com/trubitsyn/go-zero-width)](https://goreportcard.com/report/github.com/trubitsyn/go-zero-width)
Zero-width character detection and removal for Go. Inspired by [this Medium article](https://medium.com/@umpox/be-careful-what-you-copy-invisibly-inserting-usernames-into-text-with-zero-width-characters-18b4e6f17b66).## Installation
`go get github.com/trubitsyn/go-zero-width`## Usage
package mainimport (
"github.com/trubitsyn/go-zero-width"
"fmt"
)func main() {
login := "abcdef" // zero-width space between "c" and "d"
clean := zerowidth.RemoveZeroWidthCharacters(login) // a b c d e f
fmt.Printf("% x\n", login) // 61 62 63 e2 80 8b 64 65 66
fmt.Printf("% x\n", clean) // 61 62 63 64 65 66
}## Supported characters
* Zero-width space (U+200B)
* Zero-width no-break space (U+FEFF)
* Zero-width joiner (U+200D)
* Zero-width non-joiner (U+200C)## Testing
```
go get -t github.com/trubitsyn/go-zero-width
go test github.com/trubitsyn/go-zero-width
```## LICENSE
```
Copyright 2018 Nikola TrubitsynLicensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```