Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ToValidUTF8 (0.16 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.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)
Back to top