Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 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. docs/debugging/xl-meta/main.go

    					b0 = fmt.Sprintf("%s: ", string(b))
    				}
    				b, err := decode(r, file)
    				if err != nil {
    					return err
    				}
    				b = bytes.TrimSpace(b)
    				if !ndjson {
    					b = bytes.TrimFunc(b, func(r rune) bool {
    						return r == '{' || r == '}' || r == '\n' || r == '\r'
    					})
    				}
    
    				toPrint = append(toPrint, fmt.Sprintf("%s%s", b0, string(b)))
    			}
    		}
    		sort.Strings(toPrint)
    Go
    - Registered: Sun May 05 19:28:20 GMT 2024
    - Last Modified: Wed Apr 24 17:56:22 GMT 2024
    - 20.2K bytes
    - Viewed (1)
Back to top