Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
36
Task/Binary-strings/Pluto/binary-strings.pluto
Normal file
36
Task/Binary-strings/Pluto/binary-strings.pluto
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
-- Create string.
|
||||
local s = "abc"
|
||||
|
||||
-- Destroy string (not really see notes above).
|
||||
s = nil
|
||||
|
||||
-- (Re)assignment.
|
||||
s = "def"
|
||||
|
||||
-- Comparison.
|
||||
local b = (s == "abc") -- false
|
||||
local c = (s <= "ghi") -- true
|
||||
|
||||
-- Cloning/copying.
|
||||
local t = s
|
||||
|
||||
-- Check if empty.
|
||||
s = ""
|
||||
b = (s != "") -- false
|
||||
b = (#s == 0) -- true
|
||||
|
||||
-- Append a byte.
|
||||
s ..= "b"
|
||||
|
||||
-- Extract a substring.
|
||||
s = "ghijkl"
|
||||
t = s:sub(2, 5) -- "hijk"
|
||||
|
||||
-- Replace a byte or string.
|
||||
s = "abracadabra"
|
||||
s = s:replace("a", "z") -- "zbrzczdzbrz"
|
||||
|
||||
-- Join strings.
|
||||
s = "abc"
|
||||
t = "def"
|
||||
local u = s .. t -- "abcdef"
|
||||
Loading…
Add table
Add a link
Reference in a new issue