"utf8s" -> "utf8"

master
Charles Iliya Krempeaux 2022-07-18 16:36:02 -07:00
parent e35f8ab59d
commit 2129573f6d
21 changed files with 39 additions and 39 deletions

View File

@ -1,6 +1,6 @@
# go-utf8
Package **utf8s** provides tools for working with Unicode encoded as UTF-8, for the Go programming language.
Package **utf8** provides tools for working with Unicode encoded as UTF-8, for the Go programming language.
## Documention
@ -17,7 +17,7 @@ var reader io.Reader
// ...
r, n, err := utf8s.ReadRune(reader)
r, n, err := utf8.ReadRune(reader)
```
```go
@ -29,7 +29,7 @@ var r rune
// ...
n, err := utf8s.WriteRune(w, r)
n, err := utf8.WriteRune(w, r)
```
```go
@ -37,7 +37,7 @@ var reader io.Reader
// ...
runeReader := utf8s.NewRuneReader(reader)
runeReader := utf8.NewRuneReader(reader)
// ...
@ -49,7 +49,7 @@ var reader io.Reader
// ...
runeScanner := utf8s.NewRuneScanner(reader)
runeScanner := utf8.NewRuneScanner(reader)
// ...

12
doc.go
View File

@ -1,5 +1,5 @@
/*
Package utf8s provides tools for working with Unicode encoded as UTF-8.
Package utf8 provides tools for working with Unicode encoded as UTF-8.
Example
@ -8,7 +8,7 @@ Example
// ...
r, n, err := utf8s.ReadRune(reader)
r, n, err := utf8.ReadRune(reader)
Example
@ -21,7 +21,7 @@ Example
// ...
n, err := utf8s.WriteRune(w, r)
n, err := utf8.WriteRune(w, r)
Example
@ -30,7 +30,7 @@ Example
// ...
runeReader := utf8s.NewRuneReader(reader)
runeReader := utf8.NewRuneReader(reader)
// ..
@ -43,7 +43,7 @@ Example
// ...
runeScanner := utf8s.NewRuneScanner(reader)
runeScanner := utf8.NewRuneScanner(reader)
// ...
@ -120,4 +120,4 @@ This is done as described in the following table:
*/
package utf8s
package utf8

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"errors"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"bytes"
@ -8,7 +8,7 @@ import (
//
// Example
//
// utf8s.FormatBinary('۵')
// utf8.FormatBinary('۵')
//
// // Outputs:
// // <<0b11011011 ; 0b10110101>>

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"testing"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
type InvalidUTF8Complainer interface {
error

10
len.go
View File

@ -1,28 +1,28 @@
package utf8s
package utf8
// Len returns the number of bytes in a UTF-8 encoding of this Unicode code point.
//
// Example
//
// length := utf8s.Len('A')
// length := utf8.Len('A')
//
// // length == 1
//
// Example
//
// length := utf8s.Len('r')
// length := utf8.Len('r')
//
// // length == 1
//
// Example
//
// length := utf8s.Len('¡')
// length := utf8.Len('¡')
//
// // length == 2
//
// Example
//
// length := utf8s.Len('۵')
// length := utf8.Len('۵')
//
// // length == 2
func Len(r rune) int {

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"testing"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
type NilReaderComplainer interface {
error

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
type NilWriterComplainer interface {
error

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"io"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"io"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
const (
RuneError = '\uFFFD' // Unicode Replacement Character (U+FFFD).

View File

@ -1,10 +1,10 @@
package utf8s
package utf8
import (
"io"
)
// A utf8s.RuneReader implements the io.RuneReader interface by reading from an io.Reader.
// A utf8.RuneReader implements the io.RuneReader interface by reading from an io.Reader.
type RuneReader struct {
reader io.Reader
}

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"io"

View File

@ -1,10 +1,10 @@
package utf8s
package utf8
import (
"io"
)
// A utf8s.RuneScanner implements the io.RuneScanner interface by reading from an io.Reader.
// A utf8.RuneScanner implements the io.RuneScanner interface by reading from an io.Reader.
type RuneScanner struct {
reader io.Reader

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"io"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"io"

View File

@ -1,4 +1,4 @@
package utf8s_test
package utf8_test
import (
"github.com/reiver/go-utf8"
@ -58,7 +58,7 @@ func TestRuneWriter(t *testing.T) {
var buffer strings.Builder
var total int
runeWriter := utf8s.NewRuneWriter(&buffer)
runeWriter := utf8.NewRuneWriter(&buffer)
for runeNumber, r := range test.Runes {
@ -73,7 +73,7 @@ func TestRuneWriter(t *testing.T) {
continue TestLoop
}
if expected, actual := n, utf8s.Len(r); expected != actual {
if expected, actual := n, utf8.Len(r); expected != actual {
t.Errorf("For test #%d and rune #%d, expected a certain number of bytes to be written, but actually wasn't.", testNumber, runeNumber)
for i, rr := range test.Runes {
t.Logf("\t[%d] %q (%d)", i, string(rr), rr)

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"io"

View File

@ -1,4 +1,4 @@
package utf8s
package utf8
import (
"bytes"