Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for TrimFunc (0.16 sec)

  1. src/bytes/example_test.go

    	// Output: ["Achtung! Achtung"]
    }
    
    func ExampleTrimFunc() {
    	fmt.Println(string(bytes.TrimFunc([]byte("go-gopher!"), unicode.IsLetter)))
    	fmt.Println(string(bytes.TrimFunc([]byte("\"go-gopher!\""), unicode.IsLetter)))
    	fmt.Println(string(bytes.TrimFunc([]byte("go-gopher!"), unicode.IsPunct)))
    	fmt.Println(string(bytes.TrimFunc([]byte("1234go-gopher!567"), unicode.IsNumber)))
    	// Output:
    	// -gopher!
    	// "go-gopher!"
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Mar 04 15:54:40 GMT 2024
    - 15K bytes
    - Viewed (1)
  2. src/bytes/bytes.go

    	if i >= 0 && s[i] >= utf8.RuneSelf {
    		_, wid := utf8.DecodeRune(s[i:])
    		i += wid
    	} else {
    		i++
    	}
    	return s[0:i]
    }
    
    // TrimFunc returns a subslice of s by slicing off all leading and trailing
    // UTF-8-encoded code points c that satisfy f(c).
    func TrimFunc(s []byte, f func(r rune) bool) []byte {
    	return TrimRightFunc(TrimLeftFunc(s, f), f)
    }
    
    // TrimPrefix returns s without the provided leading prefix string.
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Mon Feb 19 19:51:15 GMT 2024
    - 33.8K bytes
    - Viewed (0)
  3. src/bytes/bytes_test.go

    func TestTrimFunc(t *testing.T) {
    	for _, tc := range trimFuncTests {
    		trimmers := []struct {
    			name string
    			trim func(s []byte, f func(r rune) bool) []byte
    			out  []byte
    		}{
    			{"TrimFunc", TrimFunc, tc.trimOut},
    			{"TrimLeftFunc", TrimLeftFunc, tc.leftOut},
    			{"TrimRightFunc", TrimRightFunc, tc.rightOut},
    		}
    		for _, trimmer := range trimmers {
    			actual := trimmer.trim([]byte(tc.in), tc.f.f)
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Jan 24 16:07:25 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  4. api/go1.txt

    pkg bytes, func ToUpper([]uint8) []uint8
    pkg bytes, func ToUpperSpecial(unicode.SpecialCase, []uint8) []uint8
    pkg bytes, func Trim([]uint8, string) []uint8
    pkg bytes, func TrimFunc([]uint8, func(int32) bool) []uint8
    pkg bytes, func TrimLeft([]uint8, string) []uint8
    pkg bytes, func TrimLeftFunc([]uint8, func(int32) bool) []uint8
    pkg bytes, func TrimRight([]uint8, string) []uint8
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Wed Aug 14 18:58:28 GMT 2013
    - 1.7M bytes
    - Viewed (2)
Back to top