Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleRegexp_FindStringIndex (0.18 sec)

  1. src/regexp/example_test.go

    	re := regexp.MustCompile(`foo.?`)
    	fmt.Printf("%q\n", re.FindString("seafood fool"))
    	fmt.Printf("%q\n", re.FindString("meat"))
    	// Output:
    	// "food"
    	// ""
    }
    
    func ExampleRegexp_FindStringIndex() {
    	re := regexp.MustCompile(`ab?`)
    	fmt.Println(re.FindStringIndex("tablett"))
    	fmt.Println(re.FindStringIndex("foo") == nil)
    	// Output:
    	// [1 3]
    	// true
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 00:22:53 UTC 2023
    - 11.1K bytes
    - Viewed (0)
Back to top