You've already forked golang-base-project
Improves documentation (#13)
* Documents all env variables and adds an example project * Adds godoc comments * Fixed package naming issue
This commit is contained in:
17
text/segment.go
Normal file
17
text/segment.go
Normal file
@ -0,0 +1,17 @@
|
||||
package text
|
||||
|
||||
import "strings"
|
||||
|
||||
// BetweenStrings returns a string between the starting and ending string or an empty string if none could be found
|
||||
func BetweenStrings(str string, start string, end string) (result string) {
|
||||
s := strings.Index(str, start)
|
||||
if s == -1 {
|
||||
return
|
||||
}
|
||||
s += len(start)
|
||||
e := strings.Index(str[s:], end)
|
||||
if e == -1 {
|
||||
return
|
||||
}
|
||||
return str[s : s+e]
|
||||
}
|
Reference in New Issue
Block a user