| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func AppendByte(slice []byte, data ...byte) []byte { |
| if n > cap(slice) { // if necessary, reallocate |
| // allocate double what's needed, for future growth. |
| newSlice := make([]byte, (n+1)*2) |
| // Filter returns a new slice holding only |
| // the elements of s that satisfy fn. |
| func Filter(s []int, fn func(int) bool) []int { |
| var digitRegexp = regexp.MustCompile("[0-9]+") |
| func FindDigits(filename string) []byte { |
| b, _ := ioutil.ReadFile(filename) |
| return digitRegexp.Find(b) |
| func CopyDigits(filename string) []byte { |
| b, _ := ioutil.ReadFile(filename) |
| c := make([]byte, len(b)) |
| // place holder; no need to run |