langs a-z

This commit is contained in:
Ingy döt Net 2013-04-10 22:43:41 -07:00
parent db842d013d
commit d066446780
11389 changed files with 98361 additions and 1020 deletions

View file

@ -0,0 +1,2 @@
def empty = "";
mutable fill_later = "";

View file

@ -0,0 +1,2 @@
a_string == ""; a_string != 0;
a_string.Length == 0; a_string.Length > 0;

View file

@ -0,0 +1,21 @@
/* NetRexx */
options replace format comments java crossref symbols binary
s1 = '' -- assignment
s2 = "" -- equivalent to s1
parse '.' . s3 . -- parsing a token that doesn't exist results in an empty string
strings = [s1, s2, s3, ' ']
loop s_ = 0 to strings.length - 1
say (Rexx s_).right(3)':\-'
select
when strings[s_] == '' then say ' "'strings[s_]'" is really empty'
when strings[s_].length = 0 then say ' "'strings[s_]'" is empty'
when strings[s_] = '' then say ' "'strings[s_]'" looks empty but may not be'
when strings[s_].length > 0 then say ' "'strings[s_]'" is not empty'
otherwise nop
end
end s_
return

View file

@ -0,0 +1,9 @@
let is_string_empty s =
(s = "")
let () =
let s1 = ""
and s2 = "not empty" in
Printf.printf "s1 empty? %B\n" (is_string_empty s1);
Printf.printf "s2 empty? %B\n" (is_string_empty s2);
;;

View file

@ -0,0 +1,6 @@
s := "";
if(s->IsEmpty()) {
"s is empty"->PrintLine();
} else{
"s is not empty"->PrintLine();
};

View file

@ -0,0 +1,8 @@
DEFINE VARIABLE cc AS CHARACTER.
IF cc > '' THEN
MESSAGE 'not empty' VIEW-AS ALERT-BOX.
ELSE IF cc = ? THEN
MESSAGE 'unknown' VIEW-AS ALERT-BOX.
ELSE /* IF cc = '' */
MESSAGE 'empty' VIEW-AS ALERT-BOX.

View file

@ -0,0 +1,5 @@
a="";
isEmpty(s)=s=="" \\ Alternately:
isEmpty(s)=#s==0
isNonempty(s)=s!="" \\ Alternatively:
isNonempty(s)=#s

View file

@ -0,0 +1,3 @@
s = ''; /* assign an empty string to a variable. */
if length(s) = 0 then ... /* To test whether a string is empty */
if length(s) > 0 then ... /* to test for a non-empty string */

View file

@ -0,0 +1,3 @@
my $s = '';
say 'String is empty' unless $s.chars;
say 'String is not empty' if $s.chars;

View file

@ -0,0 +1,17 @@
Procedure.s isStringEmpty(a.s)
If a
ProcedureReturn "String is not empty, it contains '" + a + "'."
Else
ProcedureReturn "String is empty, or null."
EndIf
EndProcedure
If OpenConsole()
Define a.s = ""
Define b.s = "stuff"
PrintN(isStringEmpty(a))
PrintN(isStringEmpty(b))
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit"): Input()
CloseConsole()
EndIf

View file

@ -0,0 +1,3 @@
str s = "";
if (s=="") print("string s is empty");
if (s!="") print("string s is not empty");

View file

@ -0,0 +1,3 @@
import String;
if (isEmpty(s)) print("string s is empty");
if (isEmpty(s)) print("string s is not empty");

View file

@ -0,0 +1,5 @@
( by creating a variable )
"" keepString variable: foo
( by setting an existing variable 'foo' )
"" keepString !foo

View file

@ -0,0 +1,4 @@
: emtpy? ( $-f ) getLength 0 = ;
"" empty? putn
"hello" empty? putn

View file

@ -0,0 +1,4 @@
: notEmpty? ( $-f ) getLength 0 > ;
"" notEmpty? putn
"hello" notEmpty? putn

View file

@ -0,0 +1,11 @@
var$ = ""
' --------------
'empty string
' -------------
if var$="" then print "String is Empty"
if len(var$)=0 then print "String is Empty"
' -------------
'not empty string
' -------------
if var$<>"" then print "String Not empty."
if len(var$)>0 then print "String Not empty."

View file

@ -0,0 +1,8 @@
# assign empty string to a variable
s := ""
# check that string is empty
s = ""
# check that string is not empty
s <> ""

View file

@ -0,0 +1,4 @@
$$ MODE TUSCRIPT
s=""
IF (s=="") PRINT "s is an empty string"
IF (s!="") PRINT "s is a non-empty string"

View file

@ -0,0 +1 @@
@(bind a "")

View file

@ -0,0 +1,6 @@
@(do (defvar *a* "")
(if (equal *a* "")
(format t "empty string\n"))
(set *a* "nonempty")
(if (zerop (length *a*))
(format t "guess what?\n")))

View file

@ -0,0 +1,13 @@
# assign an empty string to a variable
s=""
# the "test" command can determine truth by examining the string itself
if [ "$s" ]; then echo "not empty"; else echo "empty"; fi
# compare the string to the empty string
if [ "$s" = "" ]; then echo "s is the empty string"; fi
if [ "$s" != "" ]; then echo "s is not empty"; fi
# examine the length of the string
if [ -z "$s" ]; then echo "the string has length zero: it is empty"; fi
if [ -n "$s" ]; then echo "the string has length non-zero: it is not empty"; fi

View file

@ -0,0 +1,14 @@
dim s as string
' assign an empty string to a variable:
s = ""
' test if a string is empty:
if s = "" then Debug.Print "empty!"
' or:
if Len(s) = 0 then Debug.Print "still empty!"
'test if a string is not empty:
if s <> "" then Debug.Print "not an empty string"
'or:
if Len(s) > 0 then Debug.Print "not empty."

View file

@ -0,0 +1,10 @@
code Text=12;
string 0; \use zero-terminated convention, instead of MSb set
char S;
[S:= ""; \assign an empty string
if S(0) = 0 then Text(0, "empty
");
S:= "Hello";
if S(0) # 0 then Text(0, "not empty
");
]