~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/pkg/bytes/bytes.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
212
212
        return a[0 : na+1]
213
213
}
214
214
 
215
 
// Split slices s into subslices separated by sep and returns a slice of
 
215
// SplitN slices s into subslices separated by sep and returns a slice of
216
216
// the subslices between those separators.
217
 
// If sep is empty, Split splits after each UTF-8 sequence.
 
217
// If sep is empty, SplitN splits after each UTF-8 sequence.
218
218
// The count determines the number of subslices to return:
219
219
//   n > 0: at most n subslices; the last subslice will be the unsplit remainder.
220
220
//   n == 0: the result is nil (zero subslices)
221
221
//   n < 0: all subslices
222
 
func Split(s, sep []byte, n int) [][]byte { return genSplit(s, sep, 0, n) }
 
222
func SplitN(s, sep []byte, n int) [][]byte { return genSplit(s, sep, 0, n) }
223
223
 
224
 
// SplitAfter slices s into subslices after each instance of sep and
 
224
// SplitAfterN slices s into subslices after each instance of sep and
225
225
// returns a slice of those subslices.
226
 
// If sep is empty, Split splits after each UTF-8 sequence.
 
226
// If sep is empty, SplitAfterN splits after each UTF-8 sequence.
227
227
// The count determines the number of subslices to return:
228
228
//   n > 0: at most n subslices; the last subslice will be the unsplit remainder.
229
229
//   n == 0: the result is nil (zero subslices)
230
230
//   n < 0: all subslices
231
 
func SplitAfter(s, sep []byte, n int) [][]byte {
 
231
func SplitAfterN(s, sep []byte, n int) [][]byte {
232
232
        return genSplit(s, sep, len(sep), n)
233
233
}
234
234
 
 
235
// Split slices s into all subslices separated by sep and returns a slice of
 
236
// the subslices between those separators.
 
237
// If sep is empty, Split splits after each UTF-8 sequence.
 
238
// It is equivalent to SplitN with a count of -1.
 
239
func Split(s, sep []byte) [][]byte { return genSplit(s, sep, 0, -1) }
 
240
 
 
241
// SplitAfter slices s into all subslices after each instance of sep and
 
242
// returns a slice of those subslices.
 
243
// If sep is empty, SplitAfter splits after each UTF-8 sequence.
 
244
// It is equivalent to SplitAfterN with a count of -1.
 
245
func SplitAfter(s, sep []byte) [][]byte {
 
246
        return genSplit(s, sep, len(sep), -1)
 
247
}
 
248
 
235
249
// Fields splits the array s around each instance of one or more consecutive white space
236
250
// characters, returning a slice of subarrays of s or an empty list if s contains only white space.
237
251
func Fields(s []byte) [][]byte {