(phixonline)-->
with javascript_semantics
string s = "abc"
s = x"ef bb bf" -- explicit binary string (the utf8 BOM)
s[2] = 0
s[3] = 'z'
if s="\#EF\0z" then puts(1,"ok\n") end if
string t = s
t[1..2] = "xy" -- s remains unaltered
?t -- "xyz"
t = "food" ?t
t[2..3] = 'e' ?t -- "feed"
t[3..2] = "ast" ?t -- "feasted"
t[3..-2] = "" ?t -- "fed"
if length(t)=0 then puts(1,"t is empty\n") end if
if t!="" then puts(1,"t is not empty\n") end if
t = "be"
t &= 't' ?t -- bet
t = 'a'&t ?t -- abet
?t[2..3] -- be
?substitute(t,"be","bbo") -- abbot
?substitute(t,"be","dep") -- adept
t = substitute(t,"be","dep") -- to actually modify t
?join({"abc","def","ghi"}) -- "abc def ghi"
?join({"abc","def","ghi"},"") -- "abcdefghi"
?join({"abc","def","ghi"},"\n") -- "abc\ndef\nghi"