mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
use the new bytes package
R=rsc DELTA=61 (8 added, 31 deleted, 22 changed) OCL=29897 CL=29899
This commit is contained in:
parent
9a9ffb2b0e
commit
424f4f0ff5
6 changed files with 23 additions and 34 deletions
|
|
@ -43,11 +43,12 @@ func Equal(a, b []byte) bool {
|
|||
|
||||
// Copy copies the source to the destination, stopping when the source
|
||||
// is all transferred. The caller must guarantee that there is enough
|
||||
// room in the destination.
|
||||
func Copy(dst, src []byte) {
|
||||
// room in the destination. It returns the number of bytes copied
|
||||
func Copy(dst, src []byte) int {
|
||||
for i, x := range src {
|
||||
dst[i] = x
|
||||
}
|
||||
return len(src)
|
||||
}
|
||||
|
||||
// Explode splits s into an array of UTF-8 sequences, one per Unicode character (still arrays of bytes).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue