Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ExampleValid (0.13 sec)

  1. src/unicode/utf8/example_test.go

    	buf := []byte("a界")
    	fmt.Println(utf8.RuneStart(buf[0]))
    	fmt.Println(utf8.RuneStart(buf[1]))
    	fmt.Println(utf8.RuneStart(buf[2]))
    	// Output:
    	// true
    	// true
    	// false
    }
    
    func ExampleValid() {
    	valid := []byte("Hello, 世界")
    	invalid := []byte{0xff, 0xfe, 0xfd}
    
    	fmt.Println(utf8.Valid(valid))
    	fmt.Println(utf8.Valid(invalid))
    	// Output:
    	// true
    	// false
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Nov 05 21:29:18 UTC 2021
    - 3.6K bytes
    - Viewed (0)
  2. src/encoding/json/example_test.go

    	if err != nil {
    		log.Fatal(err)
    	}
    
    	fmt.Println(string(b))
    	// Output:
    	// {
    	// <prefix><indent>"a": 1,
    	// <prefix><indent>"b": 2
    	// <prefix>}
    }
    
    func ExampleValid() {
    	goodJSON := `{"example": 1}`
    	badJSON := `{"example":2:]}}`
    
    	fmt.Println(json.Valid([]byte(goodJSON)), json.Valid([]byte(badJSON)))
    	// Output:
    	// true false
    }
    
    func ExampleHTMLEscape() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 13 18:45:54 UTC 2021
    - 6.1K bytes
    - Viewed (0)
Back to top