Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
1a4402a1
Commit
1a4402a1
authored
Nov 04, 2011
by
Andrew Gerrand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bytes: add Contains function
R=golang-dev, bradfitz CC=golang-dev
https://golang.org/cl/5349041
parent
632a2c59
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
bytes.go
src/pkg/bytes/bytes.go
+5
-0
No files found.
src/pkg/bytes/bytes.go
View file @
1a4402a1
...
...
@@ -88,6 +88,11 @@ func Count(s, sep []byte) int {
return
n
}
// Contains returns whether subslice is within b.
func
Contains
(
b
,
subslice
[]
string
)
bool
{
return
Index
(
b
,
subslice
)
!=
-
1
}
// Index returns the index of the first instance of sep in s, or -1 if sep is not present in s.
func
Index
(
s
,
sep
[]
byte
)
int
{
n
:=
len
(
sep
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment