Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for LastIndexAny (0.15 sec)

  1. src/bytes/example_test.go

    	// Output:
    	// 0
    	// 3
    	// -1
    }
    
    func ExampleLastIndexAny() {
    	fmt.Println(bytes.LastIndexAny([]byte("go gopher"), "MüQp"))
    	fmt.Println(bytes.LastIndexAny([]byte("go 地鼠"), "地大"))
    	fmt.Println(bytes.LastIndexAny([]byte("go gopher"), "z,!."))
    	// Output:
    	// 5
    	// 3
    	// -1
    }
    
    func ExampleLastIndexByte() {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  2. src/bytes/bytes_test.go

    func TestIndexAny(t *testing.T)  { runIndexAnyTests(t, IndexAny, "IndexAny", indexAnyTests) }
    func TestLastIndexAny(t *testing.T) {
    	runIndexAnyTests(t, LastIndexAny, "LastIndexAny", lastIndexAnyTests)
    }
    
    func TestIndexByte(t *testing.T) {
    	for _, tt := range indexTests {
    		if len(tt.b) != 1 {
    			continue
    		}
    		a := []byte(tt.a)
    		b := tt.b[0]
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
  3. src/bytes/bytes.go

    			if r == ch {
    				return i
    			}
    		}
    	}
    	return -1
    }
    
    // LastIndexAny interprets s as a sequence of UTF-8-encoded Unicode code
    // points. It returns the byte index of the last occurrence in s of any of
    // the Unicode code points in chars. It returns -1 if chars is empty or if
    // there is no code point in common.
    func LastIndexAny(s []byte, chars string) int {
    	if chars == "" {
    		// Avoid scanning all of s.
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 35.6K bytes
    - Viewed (0)
Back to top