Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for Example_is (0.17 sec)

  1. src/unicode/example_test.go

    package unicode_test
    
    import (
    	"fmt"
    	"unicode"
    )
    
    // Functions starting with "Is" can be used to inspect which table of range a
    // rune belongs to. Note that runes may fit into more than one range.
    func Example_is() {
    
    	// constant with mixed type runes
    	const mixed = "\b5Ὂg̀9! ℃ᾭG"
    	for _, c := range mixed {
    		fmt.Printf("For %q:\n", c)
    		if unicode.IsControl(c) {
    			fmt.Println("\tis control rune")
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Oct 08 00:18:29 UTC 2021
    - 5.2K bytes
    - Viewed (0)
  2. src/errors/example_test.go

    	if errors.Is(err, err1) {
    		fmt.Println("err is err1")
    	}
    	if errors.Is(err, err2) {
    		fmt.Println("err is err2")
    	}
    	// Output:
    	// err1
    	// err2
    	// err is err1
    	// err is err2
    }
    
    func ExampleIs() {
    	if _, err := os.Open("non-existing"); err != nil {
    		if errors.Is(err, fs.ErrNotExist) {
    			fmt.Println("file does not exist")
    		} else {
    			fmt.Println(err)
    		}
    	}
    
    	// Output:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Aug 16 02:08:40 UTC 2023
    - 2.2K bytes
    - Viewed (0)
Back to top