Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,15 @@
procedure Empty_String is
function Is_Empty(S: String) return Boolean is
begin
return S = ""; -- test that S is empty
end Is_Empty;
Empty: String := ""; -- Assign empty string
XXXXX: String := "Not Empty";
begin
if (not Is_Empty(Empty)) or Is_Empty(XXXXX) then
raise Program_Error with "something went wrong very very badly!!!";
end if;
end Empty_String;

View file

@ -0,0 +1,16 @@
fun main() {
mut e := "" // Declare empty string
e = "" // Assign empty string
// Use either condition to check if the string is empty
if e == "" and e.length == 0 {
println("`e` is an empty string")
}
s := "not empty"
// Use either condition to check if the string is _not_ empty
if s != "" and s.length > 0 {
println("`s` is not an empty string")
}
}

View file

@ -8,5 +8,7 @@ public function main() {
string s = "";
string t = "0";
io:println("'s' is empty? ", isEmpty(s));
io:println("'s' is not empty? ", !isEmpty(s));
io:println("'t' is empty? ", isEmpty(t));
io:println("'t' is not empty? ", !isEmpty(t));
}

View file

@ -0,0 +1,23 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. EMPTYSTR.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 str PIC X(10).
PROCEDURE DIVISION.
Begin.
* * Assign an empty string.
INITIALIZE str.
* * Or
MOVE " " TO str.
IF (str = " ")
DISPLAY "String is empty"
ELSE
DISPLAY "String is not empty"
END-IF.
STOP RUN.

View file

@ -0,0 +1,6 @@
(setq str "") ;; empty string literal
(if (= 0 (length str))
(message "string is empty"))
(if (/= 0 (length str))
(message "string is not empty"))

View file

@ -0,0 +1,5 @@
(defvar str "" "An empty string")
(if (length= str 0)
(message "string is empty")
(message "string is not empty"))

View file

@ -0,0 +1,15 @@
sequence s
-- assign an empty string
s = ""
-- another way to assign an empty string
s = {} -- "" and {} are equivalent
if not length(s) then
-- string is empty
end if
if length(s) then
-- string is not empty
end if

View file

@ -0,0 +1,8 @@
import gleam/io
import gleam/string
pub fn main() {
// "" is an UTF8 encoded empty string in Gleam.
io.println("")
assert string.length("") == 0
}

View file

@ -0,0 +1,19 @@
REM String variables are initially empty after declaring them.
PROC main:
LOCAL s$(10)
checkstr:(s$)
s$="not empty."
checkstr:(s$)
s$=""
checkstr:(s$)
GET
ENDP
PROC checkstr:(s$)
IF s$=""
PRINT "String is empty."
ELSE
PRINT "String is",s$
ENDIF
ENDP

View file

@ -0,0 +1,4 @@
[string]$alpha = "abcdefghijklmnopqrstuvwxyz"
[string]$empty = ""
# or...
[string]$empty = [String]::Empty

View file

@ -0,0 +1,2 @@
[String]::IsNullOrEmpty($alpha)
[String]::IsNullOrEmpty($empty)

View file

@ -0,0 +1,14 @@
test: func [str [string!]][
;; Print a simple report about the string: its literal form, whether it's empty, and the word "empty"
print [
mold str ;; mold: show the string as a literal (quotes visible)
pick ["is" "isn't"] empty? str ;; choose "is" if empty, otherwise "isn't"
"empty" ;; trailing label for readability
]
]
test str: copy "" ;; create a new empty string and test it
append str "abc" ;; add content to the string
test str ;; test the non-empty string
clear str ;; remove all content, making it empty again
test str ;; test the re-emptied string

View file

@ -0,0 +1,6 @@
str: ""
str .is-empty
[Boolean: true]
str2: "hello"
str2 .is-empty
[Boolean: false]

View file

@ -0,0 +1,3 @@
S ← "abc"
⍥(&p"S is empty.") =0⧻ S
⍥(&p"S is not empty.") ≠0⧻ S