Lua.VM.Stdlib.String (Lua v1.0.0-rc.0)

View Source

String standard library functions for Lua 5.3.

This module implements the Lua string library, providing functions for string manipulation. All functions are registered in the global string table when the standard library is installed.

Implemented Functions

  • string.lower(s) - converts string to lowercase
  • string.upper(s) - converts string to uppercase
  • string.len(s) - returns length of string in bytes
  • string.sub(s, i [, j]) - extracts substring (1-based indexing)
  • string.rep(s, n [, sep]) - repeats string with optional separator
  • string.reverse(s) - reverses a string
  • string.byte(s [, i [, j]]) - returns byte values of characters
  • string.char(...) - creates string from byte values
  • string.format(fmt, ...) - C-style string formatting

Pattern Matching

  • string.find(s, pattern [, init [, plain]]) - find pattern in string
  • string.match(s, pattern [, init]) - match pattern and return captures
  • string.gmatch(s, pattern) - iterate over all matches
  • string.gsub(s, pattern, repl [, n]) - global substitution