Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for TrimRight (0.14 sec)

  1. src/bytes/bytes_test.go

    	{"TrimLeft", []byte{'a', 'b'}, "ab", nil},
    	{"TrimLeft", []byte("☺"), "☺", nil},
    	{"TrimRight", nil, "", nil},
    	{"TrimRight", []byte{}, "", []byte{}},
    	{"TrimRight", []byte{'a'}, "a", []byte{}},
    	{"TrimRight", []byte{'a', 'a'}, "a", []byte{}},
    	{"TrimRight", []byte{'a'}, "ab", []byte{}},
    	{"TrimRight", []byte{'a', 'b'}, "ab", []byte{}},
    	{"TrimRight", []byte("☺"), "☺", []byte{}},
    	{"TrimPrefix", nil, "", nil},
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Mon Aug 19 19:09:04 UTC 2024
    - 61.2K bytes
    - Viewed (0)
  2. src/bytes/example_test.go

    	b = bytes.TrimSuffix(b, []byte("gopher"))
    	b = append(b, bytes.TrimSuffix([]byte("world!"), []byte("x!"))...)
    	os.Stdout.Write(b)
    	// Output: Hello, world!
    }
    
    func ExampleTrimRight() {
    	fmt.Print(string(bytes.TrimRight([]byte("453gopher8257"), "0123456789")))
    	// Output:
    	// 453gopher
    }
    
    func ExampleTrimRightFunc() {
    	fmt.Println(string(bytes.TrimRightFunc([]byte("go-gopher"), unicode.IsLetter)))
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Aug 07 17:22:36 UTC 2024
    - 14.9K bytes
    - Viewed (0)
  3. src/bytes/bytes.go

    		}
    		s = s[n:]
    	}
    	if len(s) == 0 {
    		// This is what we've historically done.
    		return nil
    	}
    	return s
    }
    
    // TrimRight returns a subslice of s by slicing off all trailing
    // UTF-8-encoded code points that are contained in cutset.
    func TrimRight(s []byte, cutset string) []byte {
    	if len(s) == 0 || cutset == "" {
    		return s
    	}
    	if len(cutset) == 1 && cutset[0] < utf8.RuneSelf {
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Tue Sep 03 20:55:15 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  4. src/archive/tar/writer.go

    	tw.blk.reset()
    
    	// Best effort for the filename.
    	name = toASCII(name)
    	if len(name) > nameSize {
    		name = name[:nameSize]
    	}
    	name = strings.TrimRight(name, "/")
    
    	var f formatter
    	v7 := tw.blk.toV7()
    	v7.typeFlag()[0] = flag
    	f.formatString(v7.name(), name)
    	f.formatOctal(v7.mode(), 0)
    	f.formatOctal(v7.uid(), 0)
    	f.formatOctal(v7.gid(), 0)
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Wed Oct 02 14:22:59 UTC 2024
    - 19.6K bytes
    - Viewed (0)
  5. src/archive/tar/reader.go

    	// nextToken gets the next token delimited by a newline. This assumes that
    	// at least one newline exists in the buffer.
    	nextToken := func() string {
    		cntNewline--
    		tok, _ := buf.ReadString('\n')
    		return strings.TrimRight(tok, "\n")
    	}
    
    	// Parse for the number of entries.
    	// Use integer overflow resistant math to check this.
    	if err := feedTokens(1); err != nil {
    		return nil, err
    	}
    Registered: Tue Nov 05 11:13:11 UTC 2024
    - Last Modified: Fri Mar 08 01:59:14 UTC 2024
    - 26.8K bytes
    - Viewed (0)
Back to top