Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for ToValidUTF8 (0.22 sec)

  1. src/strings/example_test.go

    	}))
    	// Output: ¡¡¡Hello, Gophers
    }
    
    func ExampleToValidUTF8() {
    	fmt.Printf("%s\n", strings.ToValidUTF8("abc", "\uFFFD"))
    	fmt.Printf("%s\n", strings.ToValidUTF8("a\xffb\xC0\xAFc\xff", ""))
    	fmt.Printf("%s\n", strings.ToValidUTF8("\xed\xa0\x80", "abc"))
    	// Output:
    	// abc
    	// abc
    	// abc
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 22:05:38 UTC 2023
    - 10.7K bytes
    - Viewed (0)
  2. src/strings/strings_test.go

    	{"\xFC\x80\x80\x80\x80\xAF", "\uFFFD", "\uFFFD"},
    }
    
    func TestToValidUTF8(t *testing.T) {
    	for _, tc := range toValidUTF8Tests {
    		got := ToValidUTF8(tc.in, tc.repl)
    		if got != tc.out {
    			t.Errorf("ToValidUTF8(%q, %q) = %q; want %q", tc.in, tc.repl, got, tc.out)
    		}
    	}
    }
    
    func BenchmarkToUpper(b *testing.B) {
    	for _, tc := range upperTests {
    		b.Run(tc.in, func(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 12:58:37 UTC 2024
    - 53K bytes
    - Viewed (0)
  3. src/strings/strings.go

    func ToTitleSpecial(c unicode.SpecialCase, s string) string {
    	return Map(c.ToTitle, s)
    }
    
    // ToValidUTF8 returns a copy of the string s with each run of invalid UTF-8 byte sequences
    // replaced by the replacement string, which may be empty.
    func ToValidUTF8(s, replacement string) string {
    	var b Builder
    
    	for i, c := range s {
    		if c != utf8.RuneError {
    			continue
    		}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 16:48:16 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  4. 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) }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 12:58:37 UTC 2024
    - 56.5K bytes
    - Viewed (0)
  5. api/go1.13.txt

    pkg bytes, func ToValidUTF8([]uint8, []uint8) []uint8
    pkg crypto/ed25519, const PrivateKeySize = 64
    pkg crypto/ed25519, const PrivateKeySize ideal-int
    pkg crypto/ed25519, const PublicKeySize = 32
    pkg crypto/ed25519, const PublicKeySize ideal-int
    pkg crypto/ed25519, const SeedSize = 32
    pkg crypto/ed25519, const SeedSize ideal-int
    pkg crypto/ed25519, const SignatureSize = 64
    pkg crypto/ed25519, const SignatureSize ideal-int
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 08 18:44:16 UTC 2019
    - 452.6K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"Title", Func, 0},
    		{"ToLower", Func, 0},
    		{"ToLowerSpecial", Func, 0},
    		{"ToTitle", Func, 0},
    		{"ToTitleSpecial", Func, 0},
    		{"ToUpper", Func, 0},
    		{"ToUpperSpecial", Func, 0},
    		{"ToValidUTF8", Func, 13},
    		{"Trim", Func, 0},
    		{"TrimFunc", Func, 0},
    		{"TrimLeft", Func, 0},
    		{"TrimLeftFunc", Func, 0},
    		{"TrimPrefix", Func, 1},
    		{"TrimRight", Func, 0},
    		{"TrimRightFunc", Func, 0},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top