Empty string: Difference between revisions

→‎{{header|Nyquist}}: syntax variations
m (Nyquist has been added.)
(→‎{{header|Nyquist}}: syntax variations)
Line 1,446:
 
=={{header|Nyquist}}==
===Lisp Syntax===
Audacity plugin
<lang Nyquistlisp>;nyquist plug-in
(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 "TheIs a string isn't empty."))
(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 stringemptystring = "" then
print "is empty string"
else
print "is not empty string"
</lang>
 
 
===Audacity plug-in (LISP syntax)===
<lang lisp>
;nyquist plug-in
;version 14
;type tool
;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 not empty.")
end
</lang>
else
 
begin
 
print "The string isn't empty."
===Audacity plug-in (SAL syntax)===
end
return ""</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}}==
Anonymous user