Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
24
Task/Binary-strings/Phix/binary-strings.phix
Normal file
24
Task/Binary-strings/Phix/binary-strings.phix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue