gstr_contain.go 761 B

123456789101112131415161718192021222324
  1. // Copyright 2019 gf Author(https://github.com/gogf/gf). All Rights Reserved.
  2. //
  3. // This Source Code Form is subject to the terms of the MIT License.
  4. // If a copy of the MIT was not distributed with this file,
  5. // You can obtain one at https://github.com/gogf/gf.
  6. package gstr
  7. import "strings"
  8. // Contains reports whether <substr> is within <str>, case-sensitively.
  9. func Contains(str, substr string) bool {
  10. return strings.Contains(str, substr)
  11. }
  12. // ContainsI reports whether substr is within str, case-insensitively.
  13. func ContainsI(str, substr string) bool {
  14. return PosI(str, substr) != -1
  15. }
  16. // ContainsAny reports whether any Unicode code points in <chars> are within <s>.
  17. func ContainsAny(s, chars string) bool {
  18. return strings.ContainsAny(s, chars)
  19. }