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
1
Task/Reverse-a-string/Phix/reverse-a-string-1.phix
Normal file
1
Task/Reverse-a-string/Phix/reverse-a-string-1.phix
Normal file
|
|
@ -0,0 +1 @@
|
|||
?reverse("asdf")
|
||||
19
Task/Reverse-a-string/Phix/reverse-a-string-2.phix
Normal file
19
Task/Reverse-a-string/Phix/reverse-a-string-2.phix
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function unicode_reverse(string utf8)
|
||||
sequence utf32 = utf8_to_utf32(utf8)
|
||||
integer ch
|
||||
-- the assumption is made that <char><comb1><comb2>
|
||||
-- and <char><comb2><comb1> etc would work the same.
|
||||
for i=1 to length(utf32) do
|
||||
ch = utf32[i]
|
||||
if (ch>=0x300 and ch<=0x36f)
|
||||
or (ch>=0x1dc0 and ch<=0x1dff)
|
||||
or (ch>=0x20d0 and ch<=0x20ff)
|
||||
or (ch>=0xfe20 and ch<=0xfe2f) then
|
||||
utf32[i] = utf32[i-1]
|
||||
utf32[i-1] = ch
|
||||
end if
|
||||
end for
|
||||
utf32 = reverse(utf32)
|
||||
utf8 = utf32_to_utf8(utf32)
|
||||
return utf8
|
||||
end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue