Empty string: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 2,895: | Line 2,895: | ||
</pre> |
</pre> |
||
=={{header|X86-64 Assembly}}== |
|||
===UASM 2.52=== |
|||
<lang asm> |
|||
option casemap:none |
|||
printf proto :qword, :VARARG |
|||
exit proto :dword |
|||
.data |
|||
e_str db 1 dup (0) |
|||
.code |
|||
main proc |
|||
xor rcx, rcx |
|||
lea rax, e_str |
|||
cmp byte ptr [rax+rcx],0 ;; Is e_str[0] equal to 0? |
|||
je _isempty ;; Yes so goto isEmpty |
|||
jne _notempty ;; No, got notEmpty |
|||
jmp _exit ;; Neither condition is met, so exit. |
|||
_isempty: |
|||
invoke printf, CSTR("e_str is empty",10) |
|||
lea rax, e_str |
|||
mov byte ptr [rax+0], 's' ;; Copy a char into e_str[0] |
|||
jmp main ;; Test again.. |
|||
_notempty: |
|||
invoke printf, CSTR("e_str is NOT empty",10) |
|||
;; Fall though to exit here.. |
|||
_exit: |
|||
xor rsi, rsi |
|||
call exit |
|||
ret |
|||
main endp |
|||
end |
|||
</lang> |
|||
{{out}} |
|||
<pre> |
|||
e_str is empty |
|||
e_str is NOT empty |
|||
</pre> |
|||
=={{header|XLISP}}== |
=={{header|XLISP}}== |
||
<code>STRING-NULL?</code> returns true if its argument is a string of length zero. In a REPL: |
<code>STRING-NULL?</code> returns true if its argument is a string of length zero. In a REPL: |