Empty string: Difference between revisions

Content added Content deleted
m (Nyquist has been added.)
(→‎{{header|Nyquist}}: syntax variations)
Line 1,446: Line 1,446:


=={{header|Nyquist}}==
=={{header|Nyquist}}==
===Lisp Syntax===
Audacity plugin
<lang Nyquist>;nyquist plug-in
<lang lisp>
(setf emptystring "") ;binds variable'emptystring' to the empty string ""
;version 1

(let ((emptystring "")) ;; Binds local variable 'emptystring' to the empty string ""
(when (string-equal emptystring "") ;;case insensitive string comparison
(print "Is an empty string")) ;;bad argument error if not a string
(when (stringp emptystring)
(print "Is a string"))
(when (not (stringp emptystring))
(print "Is not a string"))
(when (and (stringp emptystring)(= (length emptystring) 0))
(print "Is an empty string"))
(when (and (stringp emptystring)(> (length emptystring) 0))
(print "Is a non-empty string")))
</lang>

===SAL Syntax===
<lang sal>
define variable emptystring = "" ;binds variable'emptystring' to the empty string ""

if emptystring = "" then
print "is empty string"
else
print "is not empty string"
</lang>


===Audacity plug-in (LISP syntax)===
<lang lisp>
;nyquist plug-in
;version 4
;type tool
;type tool
;name "Empty string"
;name "Empty string"

;debugflags trace
(setq emptystring "") ;; Define global variable
define variable string = ""

if string = "" then
(if (string= emptystring "") ;;case sensitive string comparison
begin
print "The string is empty."
"The string is empty."
"The string is not empty.")
end
</lang>
else

begin

print "The string isn't empty."
===Audacity plug-in (SAL syntax)===
end
return ""</lang>
<lang Nyquist>
;nyquist plug-in
;version 4
;codetype sal
;type tool
;name "Empty string"

define variable emptystring = "a" ;; Define global variable

;; The ternary operator is #?
return #?(emptystring = "",
"The string is empty.",
"The string is not empty.")
</lang>


=={{header|oberon-2}}==
=={{header|oberon-2}}==