package
0.0.0-20241221154219-7c8852dcd4c8
Repository: https://github.com/venerasf/go-lua-libs.git
Documentation: pkg.go.dev
# README
strings 
Usage
local inspect = require("inspect")
local strings = require("strings")
-- strings.split(string, sep)
local result = strings.split("a b c d", " ")
print(inspect(result, {newline="", indent=""}))
-- 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
Reader/Writer classes often used with json+yaml Encoder/Decoder
reader = strings.new_reader([[{"foo":"bar","baz":"buz"}]])
assert(reader:read("*a") == [[{"foo":"bar","baz":"buz"}]])
writer = strings.new_builder()
writer:write("foo", "bar", 123)
assert(writer:string() == "foobar123")
# Functions
No description provided by the author
No description provided by the author
Contains lua strings.contains(string, cutset) Port of go string.Contains() returns bool.
Fields lua strings.fields(string) Port of go string.Fields() returns table.
HasPrefix lua strings.has_prefix(string, suffix): port of go string.HasPrefix() return bool.
HasSuffix lua strings.has_suffix(string, prefix): port of go string.HasSuffix() returns bool.
Loader is the module loader function.
No description provided by the author
No description provided by the author
Preload adds strings to the given Lua state's package.preload table.
Split lua strings.split(string, sep): port of go string.Split() returns table.
Trim lua strings.trim(string, cutset) Port of go string.Trim() returns string.
TrimPrefix lua strings.trim_prefix(string, cutset) Port of go string.TrimPrefix() returns string.
TrimSpace lua strings.trim_space(string) Port of go string.TrimSpace() returns string.
TrimSuffix lua strings.trim_suffix(string, cutset) Port of go string.TrimSuffix() returns string.