Empty string: Difference between revisions
Content added Content deleted
Childishbeat (talk | contribs) m (Nyquist has been added.) |
(→{{header|Nyquist}}: syntax variations) |
||
Line 1,446: | Line 1,446: | ||
=={{header|Nyquist}}== |
=={{header|Nyquist}}== |
||
===Lisp Syntax=== |
|||
Audacity plugin |
|||
<lang |
<lang lisp> |
||
(setf emptystring "") ;binds variable'emptystring' to the empty string "" |
|||
⚫ | |||
(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) |
|||
⚫ | |||
(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 "" |
|||
⚫ | |||
print "is empty string" |
|||
⚫ | |||
print "is not empty string" |
|||
</lang> |
|||
===Audacity plug-in (LISP syntax)=== |
|||
<lang lisp> |
|||
;nyquist plug-in |
|||
⚫ | |||
;type tool |
;type tool |
||
;name "Empty string" |
;name "Empty string" |
||
;debugflags trace |
|||
(setq emptystring "") ;; Define global variable |
|||
define variable string = "" |
|||
⚫ | |||
(if (string= emptystring "") ;;case sensitive string comparison |
|||
begin |
|||
"The string is empty." |
|||
"The string is not empty.") |
|||
end |
|||
</lang> |
|||
⚫ | |||
begin |
|||
⚫ | |||
===Audacity plug-in (SAL syntax)=== |
|||
end |
|||
<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}}== |