2021-01-17 21:46:25 +08:00
|
|
|
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
2020-02-25 21:03:07 +08:00
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
|
|
// If a copy of the MIT was not distributed with this file,
|
|
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
|
|
|
|
package gstr
|
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
2021-10-21 18:22:47 +08:00
|
|
|
// Contains reports whether `substr` is within `str`, case-sensitively.
|
2020-02-25 21:03:07 +08:00
|
|
|
func Contains(str, substr string) bool {
|
|
|
|
return strings.Contains(str, substr)
|
|
|
|
}
|
|
|
|
|
|
|
|
// ContainsI reports whether substr is within str, case-insensitively.
|
|
|
|
func ContainsI(str, substr string) bool {
|
|
|
|
return PosI(str, substr) != -1
|
|
|
|
}
|
|
|
|
|
2021-10-21 18:22:47 +08:00
|
|
|
// ContainsAny reports whether any Unicode code points in `chars` are within `s`.
|
2020-02-25 21:03:07 +08:00
|
|
|
func ContainsAny(s, chars string) bool {
|
|
|
|
return strings.ContainsAny(s, chars)
|
|
|
|
}
|