Skip to content

Latest commit

 

History

History

strings

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

strings

origin code: https://github.com/vadv/gopher-lua-libs/tree/master/strings

Usage

local strings = require("strings")

-- strings.split(string, sep)
local result = strings.split("a b c d", " ")
-- Output: { "a", "b", "c", "d" }

-- strings.has_prefix(string, prefix)
local result = strings.has_prefix("abcd", "a")
-- Output: true

-- strings.has_suffix(string, suffix)
local result = strings.has_suffix("abcd", "d")
-- Output: true

-- strings.trim(string, cutset)
local result = strings.trim("abcd", "d")
-- Output: abc

-- strings.contains(string, substring)
local result = strings.contains("abcd", "d")
-- Output: true