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
11
Task/String-case/ECL/string-case.ecl
Normal file
11
Task/String-case/ECL/string-case.ecl
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
IMPORT STD; //Imports the Standard Library
|
||||
|
||||
STRING MyBaseString := 'alphaBETA';
|
||||
|
||||
UpperCased := STD.str.toUpperCase(MyBaseString);
|
||||
LowerCased := STD.str.ToLowerCase(MyBaseString);
|
||||
TitleCased := STD.str.ToTitleCase(MyBaseString);
|
||||
|
||||
OUTPUT (UpperCased);
|
||||
OUTPUT (LowerCased);
|
||||
OUTPUT (TitleCased);
|
||||
10
Task/String-case/EchoLisp/string-case.echolisp
Normal file
10
Task/String-case/EchoLisp/string-case.echolisp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
(string-downcase "alphaBETA")
|
||||
→ "alphabeta"
|
||||
(string-upcase "alphaBETA")
|
||||
→ "ALPHABETA"
|
||||
(string-titlecase "alphaBETA")
|
||||
→ "Alphabeta"
|
||||
(string-randcase "alphaBETA")
|
||||
→ "alphaBEtA"
|
||||
(string-randcase "alphaBETA")
|
||||
→ "AlPHaBeTA"
|
||||
6
Task/String-case/Elm/string-case.elm
Normal file
6
Task/String-case/Elm/string-case.elm
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import String exposing (toLower, toUpper)
|
||||
|
||||
s = "alphaBETA"
|
||||
|
||||
lower = toLower s
|
||||
upper = toUpper s
|
||||
6
Task/String-case/FreeBASIC/string-case.freebasic
Normal file
6
Task/String-case/FreeBASIC/string-case.freebasic
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Dim s As String = "alphaBETA"
|
||||
Print UCase(s)
|
||||
Print LCase(s)
|
||||
Sleep
|
||||
10
Task/String-case/FutureBasic/string-case.futurebasic
Normal file
10
Task/String-case/FutureBasic/string-case.futurebasic
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
include "ConsoleWindow"
|
||||
|
||||
dim as Str255 a
|
||||
|
||||
a = "alphaBETA"
|
||||
|
||||
print a
|
||||
print ucase$(a)
|
||||
fn lcase(a)
|
||||
print a
|
||||
12
Task/String-case/Lasso/string-case.lasso
Normal file
12
Task/String-case/Lasso/string-case.lasso
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
// Direct string return
|
||||
'alphaBETA'->uppercase&
|
||||
'alphaBETA'->lowercase&
|
||||
|
||||
// Assignment and manipulation of variables
|
||||
local(toupper = 'alphaBETA')
|
||||
#toupper->uppercase
|
||||
#toupper
|
||||
|
||||
local(tolower = 'alphaBETA')
|
||||
#tolower->lowercase
|
||||
#tolower
|
||||
29
Task/String-case/Lingo/string-case-1.lingo
Normal file
29
Task/String-case/Lingo/string-case-1.lingo
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
----------------------------------------
|
||||
-- Lower to upper case (ASCII only)
|
||||
-- @param {string} str
|
||||
-- @return {string}
|
||||
----------------------------------------
|
||||
on toUpper (str)
|
||||
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
len = str.length
|
||||
repeat with i = 1 to len
|
||||
pos = offset(str.char[i], alphabet)
|
||||
if pos > 0 then put alphabet.char[pos] into char i of str
|
||||
end repeat
|
||||
return str
|
||||
end
|
||||
|
||||
----------------------------------------
|
||||
-- Upper to lower case (ASCII only)
|
||||
-- @param {string} str
|
||||
-- @return {string}
|
||||
----------------------------------------
|
||||
on toLower (str)
|
||||
alphabet = "abcdefghijklmnopqrstuvwxyz"
|
||||
len = str.length
|
||||
repeat with i = 1 to len
|
||||
pos = offset(str.char[i], alphabet)
|
||||
if pos > 0 then put alphabet.char[pos] into char i of str
|
||||
end repeat
|
||||
return str
|
||||
end
|
||||
5
Task/String-case/Lingo/string-case-2.lingo
Normal file
5
Task/String-case/Lingo/string-case-2.lingo
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
put toUpper("alphaBETA")
|
||||
-- "ALPHABETA"
|
||||
|
||||
put toLower("alphaBETA")
|
||||
-- "alphabeta"
|
||||
2
Task/String-case/LiveCode/string-case.livecode
Normal file
2
Task/String-case/LiveCode/string-case.livecode
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
put upper("alphaBETA") && lower("alphaBETA")
|
||||
ALPHABETA alphabeta
|
||||
7
Task/String-case/Nim/string-case.nim
Normal file
7
Task/String-case/Nim/string-case.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import strutils
|
||||
|
||||
var s: string = "alphaBETA_123"
|
||||
echo s," as upper case: ", toUpper(s)
|
||||
echo s," as lower case: ", toLower(s)
|
||||
echo s," as Capitalized: ", capitalize(s)
|
||||
echo s," as normal case: ", normalize(s) # remove underscores, toLower
|
||||
2
Task/String-case/Oforth/string-case.oforth
Normal file
2
Task/String-case/Oforth/string-case.oforth
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"alphaBETA" toUpper
|
||||
"alphaBETA" toLower
|
||||
5
Task/String-case/Peloton/string-case-1.peloton
Normal file
5
Task/String-case/Peloton/string-case-1.peloton
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<@ ENU$$$LSTPSTLITLIT>UPP|
|
||||
[<@ SAYELTLST>...</@>] <@ SAYHLPELTLST>...</@><@ DEFKEYELTLST>__SuperMacro|...</@>
|
||||
<@ SAY&&&LIT>alphaBETA</@>
|
||||
|
||||
</@>
|
||||
5
Task/String-case/Peloton/string-case-2.peloton
Normal file
5
Task/String-case/Peloton/string-case-2.peloton
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<# ENUMERATION LAMBDA LIST PEERSET LITERAL LITERAL>UPP|
|
||||
[<# SAY ELEMENT LIST>...</#>] <# SAY HELP ELEMENT LIST>...</#><# DEFINE KEYWORD ELEMENT LIST>__SuperMacro|...</#>
|
||||
<# SAY SUPERMACRO LITERAL>alphaBETA</#>
|
||||
|
||||
</#>
|
||||
3
Task/String-case/Phix/string-case.phix
Normal file
3
Task/String-case/Phix/string-case.phix
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
constant s = "alphaBETA"
|
||||
?upper(s)
|
||||
?lower(s)
|
||||
25
Task/String-case/Potion/string-case.potion
Normal file
25
Task/String-case/Potion/string-case.potion
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
lowercase = (str) :
|
||||
low = ("")
|
||||
str length times (i) :
|
||||
low append(if (65 <= str(i) ord and str(i) ord <= 90) :
|
||||
"abcdefghijklmnopqrstuvwxyz"(str(i) ord - 65)
|
||||
. else :
|
||||
str(i)
|
||||
.)
|
||||
.
|
||||
low join("")
|
||||
.
|
||||
uppercase = (str) :
|
||||
upp = ("")
|
||||
str length times (i) :
|
||||
upp append(if (97 <= str(i) ord and str(i) ord <= 122) :
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"(str(i) ord - 97)
|
||||
. else :
|
||||
str(i)
|
||||
.)
|
||||
.
|
||||
upp join("")
|
||||
.
|
||||
|
||||
lowercase("alphaBETA") print
|
||||
uppercase("alphaBETA") print
|
||||
4
Task/String-case/Powerbuilder/string-case.powerbuilder
Normal file
4
Task/String-case/Powerbuilder/string-case.powerbuilder
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
string ls_string
|
||||
ls_string = 'alphaBETA'
|
||||
ls_string = Upper(ls_string)
|
||||
ls_string = Lower(ls_string)
|
||||
3
Task/String-case/Ring/string-case.ring
Normal file
3
Task/String-case/Ring/string-case.ring
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
aString = "WELCOME TO THE ring programming language"
|
||||
see lower(aString) + nl
|
||||
see upper(aString) + nl
|
||||
6
Task/String-case/Sidef/string-case.sidef
Normal file
6
Task/String-case/Sidef/string-case.sidef
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
say "alphaBETA".lc; #=> alphabeta
|
||||
say "alphaBETA".uc; #=> ALPHABETA
|
||||
say "alphaBETA".tc; #=> AlphaBETA
|
||||
say "alpha BETA".wc; #=> Alpha Beta
|
||||
say "alpha BETA".tc; #=> Alpha BETA
|
||||
say "alpha BETA".tclc; #=> Alpha beta
|
||||
5
Task/String-case/Swift/string-case.swift
Normal file
5
Task/String-case/Swift/string-case.swift
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import Foundation
|
||||
|
||||
println("alphaBETA".uppercaseString)
|
||||
println("alphaBETA".lowercaseString)
|
||||
println("foO BAr".capitalizedString)
|
||||
2
Task/String-case/Ursa/string-case.ursa
Normal file
2
Task/String-case/Ursa/string-case.ursa
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
out (lower "alphaBETA") endl console
|
||||
out (upper "alphaBETA") endl console
|
||||
7
Task/String-case/jq/string-case-1.jq
Normal file
7
Task/String-case/jq/string-case-1.jq
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# like ruby's downcase - only characters A to Z are affected
|
||||
def ascii_downcase:
|
||||
explode | map( if 65 <= . and . <= 90 then . + 32 else . end) | implode;
|
||||
|
||||
# like ruby's upcase - only characters a to z are affected
|
||||
def ascii_upcase:
|
||||
explode | map( if 97 <= . and . <= 122 then . - 32 else . end) | implode;
|
||||
5
Task/String-case/jq/string-case-2.jq
Normal file
5
Task/String-case/jq/string-case-2.jq
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"alphaBETA" | ascii_upcase
|
||||
#=> "ALPHABETA"
|
||||
|
||||
"alphaBETA" | ascii_downcase
|
||||
#=> "alphabeta"
|
||||
Loading…
Add table
Add a link
Reference in a new issue