String methods

  • +: concatenates two strings together
  • *: concatenates multiple copies, i.e. "xyz" * 2 results in "xyzxyz")
  • [x]: character at position x
  • number: coerce to number
  • print: print to standard output
  • compile: compiles the string into a code object. Returns a tree if the code cannot be compiled.
  • eval: equivalent to "..."|compile|eval
  • find(string, start): return the position of the first found instance of string in the current string, starting from an optional start (defaults to 0). Returns -1 if not found.
  • substring(start, length): returns a substring of the current string, beginning from start up to length characters (defaulting to the rest of the string if not specified)
  • rfind(string, start): same as find, but starts from the end of the string instead of the beginning
  • replace(tofind, replacement, start): searches for the string specified by tofind starting from an optional start and replaces it with replacement
  • length: returns length of string
  • lower: returns lower-case version of string
  • upper: returns upper-case version of string

To implement

  • format (sprintf)