- Sort Score
- Num 10 results
- Language All
Results 1 - 3 of 3 for ToValidUTF8 (0.06 seconds)
-
src/bytes/bytes.go
func ToTitleSpecial(c unicode.SpecialCase, s []byte) []byte { return Map(c.ToTitle, s) } // ToValidUTF8 treats s as UTF-8-encoded bytes and returns a copy with each run of bytes // representing invalid UTF-8 replaced with the bytes in replacement, which may be empty. func ToValidUTF8(s, replacement []byte) []byte { b := make([]byte, 0, len(s)+len(replacement))
Created: Tue Apr 07 11:13:11 GMT 2026 - Last Modified: Thu Mar 12 17:56:55 GMT 2026 - 36.3K bytes - Click Count (0) -
src/bytes/bytes_test.go
{"\xFC\x80\x80\x80\x80\xAF", "\uFFFD", "\uFFFD"}, } func TestToValidUTF8(t *testing.T) { for _, tc := range toValidUTF8Tests { got := ToValidUTF8([]byte(tc.in), []byte(tc.repl)) if !Equal(got, []byte(tc.out)) { t.Errorf("ToValidUTF8(%q, %q) = %q; want %q", tc.in, tc.repl, got, tc.out) } } } func TestTrimSpace(t *testing.T) { runStringTests(t, TrimSpace, "TrimSpace", trimSpaceTests) }Created: Tue Apr 07 11:13:11 GMT 2026 - Last Modified: Wed Mar 11 03:07:05 GMT 2026 - 62.9K bytes - Click Count (0) -
src/bytes/example_test.go
// Original : ahoj vývojári golang // ToTitle : AHOJ VÝVOJÁRİ GOLANG } func ExampleToValidUTF8() { fmt.Printf("%s\n", bytes.ToValidUTF8([]byte("abc"), []byte("\uFFFD"))) fmt.Printf("%s\n", bytes.ToValidUTF8([]byte("a\xffb\xC0\xAFc\xff"), []byte(""))) fmt.Printf("%s\n", bytes.ToValidUTF8([]byte("\xed\xa0\x80"), []byte("abc"))) // Output: // abc // abc // abc } func ExampleTrim() {
Created: Tue Apr 07 11:13:11 GMT 2026 - Last Modified: Mon May 12 16:07:54 GMT 2025 - 16.5K bytes - Click Count (0)