Sync
This commit is contained in:
parent
6f050a029e
commit
776bba907c
3887 changed files with 59894 additions and 7280 deletions
14
Task/Empty-string/Batch-File/empty-string.bat
Normal file
14
Task/Empty-string/Batch-File/empty-string.bat
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
|
||||
::set "var" as a blank string.
|
||||
set var=
|
||||
|
||||
::check if "var" is a blank string.
|
||||
if not defined var echo Var is a blank string.
|
||||
::Alternatively,
|
||||
if %var%@ equ @ echo Var is a blank string.
|
||||
|
||||
::check if "var" is not a blank string.
|
||||
if defined var echo Var is defined.
|
||||
::Alternatively,
|
||||
if %var%@ neq @ echo Var is not a blank string.
|
||||
23
Task/Empty-string/COBOL/empty-string.cobol
Normal file
23
Task/Empty-string/COBOL/empty-string.cobol
Normal 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.
|
||||
19
Task/Empty-string/Component-Pascal/empty-string.component
Normal file
19
Task/Empty-string/Component-Pascal/empty-string.component
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
MODULE EmptyString;
|
||||
IMPORT StdLog;
|
||||
|
||||
PROCEDURE Do*;
|
||||
VAR
|
||||
s: ARRAY 64 OF CHAR;
|
||||
(* s := "" <=> s[0] := 0X => s isEmpty*)
|
||||
BEGIN
|
||||
s := "";
|
||||
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = "");StdLog.Ln;
|
||||
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # "");StdLog.Ln;
|
||||
StdLog.Ln;
|
||||
(* Or *)
|
||||
s := 0X;
|
||||
StdLog.String("Is 's' empty?:> ");StdLog.Bool(s = 0X);StdLog.Ln;
|
||||
StdLog.String("Is not 's' empty?:> ");StdLog.Bool(s # 0X);StdLog.Ln;
|
||||
StdLog.Ln;
|
||||
END Do;
|
||||
END EmptyString.
|
||||
7
Task/Empty-string/Deja-Vu/empty-string.djv
Normal file
7
Task/Empty-string/Deja-Vu/empty-string.djv
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
local :e ""
|
||||
|
||||
if not e:
|
||||
print "an empty string"
|
||||
|
||||
if e:
|
||||
print "not an empty string"
|
||||
6
Task/Empty-string/Emacs-Lisp/empty-string.l
Normal file
6
Task/Empty-string/Emacs-Lisp/empty-string.l
Normal 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"))
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
Dcl s Char(10) Varying;
|
||||
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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue