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/Empty-string/8th/empty-string-1.8th
Normal file
1
Task/Empty-string/8th/empty-string-1.8th
Normal file
|
|
@ -0,0 +1 @@
|
|||
"" var, str
|
||||
1
Task/Empty-string/8th/empty-string-2.8th
Normal file
1
Task/Empty-string/8th/empty-string-2.8th
Normal file
|
|
@ -0,0 +1 @@
|
|||
str @ s:len 0 n:= if ... then
|
||||
2
Task/Empty-string/Apex/empty-string.apex
Normal file
2
Task/Empty-string/Apex/empty-string.apex
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
String.isBlank(record.txt_Field__c);
|
||||
--Returns true if the specified String is white space, empty (''), or null; otherwise, returns false.
|
||||
6
Task/Empty-string/Axe/empty-string.axe
Normal file
6
Task/Empty-string/Axe/empty-string.axe
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
""→Str1
|
||||
!If length(Str1)
|
||||
Disp "EMPTY",i
|
||||
Else
|
||||
Disp "NOT EMPTY",i
|
||||
End
|
||||
17
Task/Empty-string/FreeBASIC/empty-string.freebasic
Normal file
17
Task/Empty-string/FreeBASIC/empty-string.freebasic
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
' FB 1.05.0 Win64
|
||||
|
||||
Sub IsEmpty(s As String)
|
||||
If Len(s) = 0 Then
|
||||
Print "String is empty"
|
||||
Else
|
||||
Print "String is not empty"
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Dim s As String ' implicitly assigned an empty string
|
||||
IsEmpty(s)
|
||||
Dim t As String = "" ' explicitly assigned an empty string
|
||||
IsEmpty(t)
|
||||
Dim u As String = "not empty"
|
||||
IsEmpty(u)
|
||||
Sleep
|
||||
13
Task/Empty-string/FutureBasic/empty-string.futurebasic
Normal file
13
Task/Empty-string/FutureBasic/empty-string.futurebasic
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
include "ConsoleWindow"
|
||||
|
||||
dim as Str255 s
|
||||
|
||||
s = ""
|
||||
if s == "" then print "String is empty"
|
||||
if s[0] == 0 then print "String is empty"
|
||||
if len(s) == 0 then print "String is empty"
|
||||
|
||||
s = "Hello"
|
||||
if s <> "" then print "String not empty."
|
||||
if s[0] then print "String not empty."
|
||||
if len(s) > 0 then print "String not empty."
|
||||
11
Task/Empty-string/I/empty-string.i
Normal file
11
Task/Empty-string/I/empty-string.i
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
software {
|
||||
var s = ""
|
||||
|
||||
if len(s) = 0
|
||||
print("Empty string!")
|
||||
end
|
||||
|
||||
if s != ""
|
||||
print("Not an empty string!")
|
||||
end
|
||||
}
|
||||
24
Task/Empty-string/LFE/empty-string.lfe
Normal file
24
Task/Empty-string/LFE/empty-string.lfe
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
> (set str "")
|
||||
()
|
||||
> (length str)
|
||||
0
|
||||
> (=:= 0 (length str))
|
||||
true
|
||||
> (=:= 0 (length "apple"))
|
||||
false
|
||||
> (=:= "apple" "")
|
||||
false
|
||||
> (=/= "apple" "")
|
||||
true
|
||||
> (=:= str "")
|
||||
true
|
||||
> (=:= "apple" '())
|
||||
false
|
||||
> (=/= "apple" '())
|
||||
true
|
||||
> (=:= str '())
|
||||
true
|
||||
> (case str ('() 'empty) ((cons head tail) 'not-empty))
|
||||
empty
|
||||
> (case "apple" ('() 'empty) ((cons head tail) 'not-empty))
|
||||
not-empty
|
||||
12
Task/Empty-string/Lasso/empty-string.lasso
Normal file
12
Task/Empty-string/Lasso/empty-string.lasso
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
//Demonstrate how to assign an empty string to a variable.
|
||||
local(str = string)
|
||||
local(str = '')
|
||||
|
||||
//Demonstrate how to check that a string is empty.
|
||||
#str->size == 0 // true
|
||||
not #str->size // true
|
||||
|
||||
//Demonstrate how to check that a string is not empty.
|
||||
local(str = 'Hello, World!')
|
||||
#str->size > 0 // true
|
||||
#str->size // true
|
||||
5
Task/Empty-string/Lingo/empty-string.lingo
Normal file
5
Task/Empty-string/Lingo/empty-string.lingo
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
str = EMPTY -- same as: str = ""
|
||||
put str=EMPTY
|
||||
-- 1
|
||||
put str<>EMPTY
|
||||
-- 0
|
||||
5
Task/Empty-string/NESL/empty-string.nesl
Normal file
5
Task/Empty-string/NESL/empty-string.nesl
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
my_empty_string = "";
|
||||
|
||||
% To make sure it is empty, we can ask whether its length is equal to zero. %
|
||||
|
||||
#my_empty_string == 0;
|
||||
12
Task/Empty-string/Nim/empty-string.nim
Normal file
12
Task/Empty-string/Nim/empty-string.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
var x = ""
|
||||
|
||||
if x == "":
|
||||
echo "empty"
|
||||
if x != "":
|
||||
echo "not empty"
|
||||
|
||||
# Alternatively:
|
||||
if x.len == 0:
|
||||
echo "empty"
|
||||
if x.len > 0:
|
||||
echo "not empty"
|
||||
2
Task/Empty-string/Oforth/empty-string.oforth
Normal file
2
Task/Empty-string/Oforth/empty-string.oforth
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
"" isEmpty
|
||||
"" isEmpty not
|
||||
9
Task/Empty-string/Phix/empty-string.phix
Normal file
9
Task/Empty-string/Phix/empty-string.phix
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
string s
|
||||
|
||||
s = "" -- assign an empty string
|
||||
|
||||
if length(s)=0 then -- string is empty
|
||||
if s="" then -- string is empty
|
||||
|
||||
if length(s)!=0 then -- string is not empty
|
||||
if s!="" then -- string is not empty
|
||||
6
Task/Empty-string/Ring/empty-string.ring
Normal file
6
Task/Empty-string/Ring/empty-string.ring
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
cStr = NULL # empty string
|
||||
if cStr = NULL
|
||||
see "cstr is an empty string!" + nl
|
||||
else
|
||||
see "cstr is not empty string!" + nl
|
||||
ok
|
||||
2
Task/Empty-string/Sidef/empty-string-1.sidef
Normal file
2
Task/Empty-string/Sidef/empty-string-1.sidef
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
var s = "";
|
||||
var s = String.new;
|
||||
5
Task/Empty-string/Sidef/empty-string-2.sidef
Normal file
5
Task/Empty-string/Sidef/empty-string-2.sidef
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
s == "";
|
||||
s.length == 0;
|
||||
s.is_empty;
|
||||
s ~~ /^\z/;
|
||||
s ~~ /\A\z/;
|
||||
4
Task/Empty-string/Sidef/empty-string-3.sidef
Normal file
4
Task/Empty-string/Sidef/empty-string-3.sidef
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
s != "";
|
||||
s.length > 0;
|
||||
s ~~ /./s;
|
||||
s !~ /^\z/;
|
||||
6
Task/Empty-string/Swift/empty-string.swift
Normal file
6
Task/Empty-string/Swift/empty-string.swift
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
var s = ""
|
||||
if s.isEmpty { // alternately, s == ""
|
||||
println("s is empty")
|
||||
} else {
|
||||
println("s is not empty")
|
||||
}
|
||||
8
Task/Empty-string/Ursa/empty-string.ursa
Normal file
8
Task/Empty-string/Ursa/empty-string.ursa
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
decl string s
|
||||
set s ""
|
||||
|
||||
if (= s "")
|
||||
out "empty" endl console
|
||||
else
|
||||
out "not empty" endl console
|
||||
end if
|
||||
1
Task/Empty-string/jq/empty-string-1.jq
Normal file
1
Task/Empty-string/jq/empty-string-1.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
"" as $x
|
||||
3
Task/Empty-string/jq/empty-string-2.jq
Normal file
3
Task/Empty-string/jq/empty-string-2.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
s == ""
|
||||
# or:
|
||||
s|length == 0
|
||||
3
Task/Empty-string/jq/empty-string-3.jq
Normal file
3
Task/Empty-string/jq/empty-string-3.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
s != ""
|
||||
# or:
|
||||
s.length != 0 # etc.
|
||||
Loading…
Add table
Add a link
Reference in a new issue