mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
Basic HTTP client.
R=rsc APPROVED=rsc DELTA=392 (386 added, 2 deleted, 4 changed) OCL=29963 CL=30107
This commit is contained in:
parent
c4aa021733
commit
f315fb3d56
6 changed files with 392 additions and 6 deletions
|
|
@ -53,6 +53,21 @@ func Index(s, sep string) int {
|
|||
return -1
|
||||
}
|
||||
|
||||
// Index returns the index of the last instance of sep in s, or -1 if sep is not present in s.
|
||||
func LastIndex(s, sep string) int {
|
||||
n := len(sep);
|
||||
if n == 0 {
|
||||
return len(s)
|
||||
}
|
||||
c := sep[0];
|
||||
for i := len(s)-n; i >= 0; i-- {
|
||||
if s[i] == c && (n == 1 || s[i:i+n] == sep) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
// Split returns the array representing the substrings of s separated by string sep. Adjacent
|
||||
// occurrences of sep produce empty substrings. If sep is empty, it is the same as Explode.
|
||||
func Split(s, sep string) []string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue