kebabcase

function kebabcase( strlst ) --> str

Description

Concatenate the assigned words in the array table to a kebab case string.

Parameters

strlst

An array table with strings.

Return Values

str

The generated kebab case string.

Code

--ZFUNC-kebabcase-v1
local function kebabcase( strlst ) --> str
   local str = {}
   for i, v in ipairs( strlst ) do
      table.insert( str, string.lower( v ) )
   end
   return table.concat( str, "-" )
end

return kebabcase

Examples

local t = require( "taptest" )
local kebabcase = require( "kebabcase" )

t( kebabcase{ "Wiki", "Word", "BUMPY", "caPS" }, "wiki-word-bumpy-caps" )

t()

Inspired by

See also