mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-20 13:50:55 +02:00
nip54: trim spaces.
This commit is contained in:
parent
6f32e4da63
commit
01d5dc02c5
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NormalizeIdentifier(name string) string {
|
func NormalizeIdentifier(name string) string {
|
||||||
name = strings.ToLower(name)
|
name = strings.TrimSpace(strings.ToLower(name))
|
||||||
res, _, _ := transform.Bytes(norm.NFKC, []byte(name))
|
res, _, _ := transform.Bytes(norm.NFKC, []byte(name))
|
||||||
runes := []rune(string(res))
|
runes := []rune(string(res))
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ func TestNormalization(t *testing.T) {
|
|||||||
before string
|
before string
|
||||||
after string
|
after string
|
||||||
}{
|
}{
|
||||||
{"hello", "hello"},
|
{" hello ", "hello"},
|
||||||
{"Goodbye", "goodbye"},
|
{"Goodbye", "goodbye"},
|
||||||
{"the long and winding road / that leads to your door", "the-long-and-winding-road---that-leads-to-your-door"},
|
{"the long and winding road / that leads to your door", "the-long-and-winding-road---that-leads-to-your-door"},
|
||||||
{"it's 平仮名", "it-s-平仮名"},
|
{"it's 平仮名", "it-s-平仮名"},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user