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
29
Task/Substring/Phix/substring-1.phix
Normal file
29
Task/Substring/Phix/substring-1.phix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
--(1) starting from n characters in and of m length;
|
||||
--(2) starting from n characters in, up to the end of the string;
|
||||
--(3) whole string minus last character;
|
||||
--(4) starting from a known character within the string and of m length;
|
||||
--(5) starting from a known substring within the string and of m length.
|
||||
|
||||
constant sentence = "the last thing the man said was the",
|
||||
n = 10, m = 5
|
||||
integer k, l
|
||||
l = n+m-1
|
||||
if l<=length(sentence) then
|
||||
?sentence[n..l] -- (1)
|
||||
end if
|
||||
if n<=length(sentence) then
|
||||
?sentence[n..-1] -- (2) or [n..$]
|
||||
end if
|
||||
if length(sentence)>0 then
|
||||
?sentence[1..-2] -- (3) or [1..$-1]
|
||||
end if
|
||||
k = find('m',sentence)
|
||||
l = k+m-1
|
||||
if l<=length(sentence) then
|
||||
?sentence[k..l] -- (4)
|
||||
end if
|
||||
k = match("aid",sentence)
|
||||
l = k+m-1
|
||||
if l<=length(sentence) then
|
||||
?sentence[k..l] -- (5)
|
||||
end if
|
||||
5
Task/Substring/Phix/substring-2.phix
Normal file
5
Task/Substring/Phix/substring-2.phix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
?sentence[n..n+m-1]
|
||||
?sentence[n..-1]
|
||||
?sentence[1..-2]
|
||||
?(sentence[find('m',sentence)..$])[1..m]
|
||||
?(sentence[match("aid",sentence)..$])[1..m]
|
||||
Loading…
Add table
Add a link
Reference in a new issue