Popularity
3.9
Growing
Activity
3.3
Growing
77
1
8

Programming language: Go
Latest version: v1.0.0

go-zero-width alternatives and similar packages

Based on the "Specific Formats" category

Do you think we are missing an alternative of go-zero-width or a related project?

Add another 'Specific Formats' Package

README

go-zero-width Mentioned in Awesome Go Golang Weekly #241 Golang Weekly #241 Build Status GoDoc Go Report Card

Zero-width character detection and removal for Go. Inspired by this Medium article.

Installation

go get github.com/trubitsyn/go-zero-width

Usage

package main

import ( "github.com/trubitsyn/go-zero-width" "fmt" )

func main() { login := "abc​def" // 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 Trubitsyn

Licensed 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 at

    http://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.


*Note that all licence references and agreements mentioned in the go-zero-width README section above are relevant to that project's source code only.