Skip to content

The strings library

Tim Hardcastle edited this page Feb 29, 2024 · 4 revisions

As these functions are in effect wrappers around their Golang counterparts, I hope it will suffice for now just to give the signatures of the functions in the library without detailed descriptions of what they do.

  • compare(a, b string)
  • contains(s, substr string)
  • containsAny(s, chars string)
  • count(s, substr string)
  • cut(s, sep string)
  • equalFold(s, t string)
  • fields(s string)
  • hasPrefix(s, prefix string)
  • hasSuffix(s, suffix string)
  • index(s, substr string)
  • indexAny(s, chars string)
  • lastIndex(s, substr string)
  • lastIndexAny(s, chars string)
  • repeat(s string, c int)
  • replace(s string, old string, new string, n int)
  • replaceAll(s string, old string, new string)
  • split(s string, sep string)
  • splitAfter(s string, sep string)
  • splitAfterN(s string, sep string, n int)
  • splitN(s string, sep string, n int)
  • toLower(s string)
  • toTitle(s string)
  • toUpper(s string)
  • toValidUTF8(s, replacementString string)
  • trim(s, cutset string)
  • trimLeft(s, cutset string)
  • trimPrefix(s, prefix string)
  • trimRight(s, cutset string)
  • trimSuffix(s, prefix string)
Clone this wiki locally