Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
38
Task/Substring/Logo/substring.logo
Normal file
38
Task/Substring/Logo/substring.logo
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
to items :n :thing
|
||||
if :n >= count :thing [output :thing]
|
||||
output items :n butlast :thing
|
||||
end
|
||||
|
||||
to butitems :n :thing
|
||||
if or :n <= 0 empty? :thing [output :thing]
|
||||
output butitems :n-1 butfirst :thing
|
||||
end
|
||||
|
||||
to middle :n :m :thing
|
||||
output items :m-(:n-1) butitems :n-1 :thing
|
||||
end
|
||||
|
||||
to lastitems :n :thing
|
||||
if :n >= count :thing [output :thing]
|
||||
output lastitems :n butfirst :thing
|
||||
end
|
||||
|
||||
to starts.with :sub :thing
|
||||
if empty? :sub [output "true]
|
||||
if empty? :thing [output "false]
|
||||
if not equal? first :sub first :thing [output "false]
|
||||
output starts.with butfirst :sub butfirst :thing
|
||||
end
|
||||
|
||||
to members :sub :thing
|
||||
output cascade [starts.with :sub ?] [bf ?] :thing
|
||||
end
|
||||
|
||||
; note: Logo indices start at one
|
||||
make "s "abcdefgh
|
||||
print items 3 butitems 2 :s ; cde
|
||||
print middle 3 5 :s ; cde
|
||||
print butitems 2 :s ; cdefgh
|
||||
print butlast :s ; abcdefg
|
||||
print items 3 member "d :s ; def
|
||||
print items 3 members "de :s ; def
|
||||
Loading…
Add table
Add a link
Reference in a new issue