forked from darktable-org/lua-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
split
deekayhd edited this page Mar 29, 2026
·
1 revision
split
split a string on a specified separator
local du = require "lib/dtutils"
local result = du.split(str, pat)str - string - the string to split
pat - string - the pattern to split on
split separates a string into a table of strings. The strings are separated at each occurrence of the supplied pattern. The pattern may be any pattern as described in the lua docs. Each match of the pattern is consumed and not returned.
result - table - a table of strings on success, or an empty table on error
split("/a/long/path/name/to/a/file.txt", "/") would return a table like
{"a", "long", "path", "name", "to", "a", "file.txt"}