Empty string: Difference between revisions

Added AutoHotkey examples
(Added AutoHotkey examples)
Line 11:
[[Category:String manipulation]]
 
=={{header|AutoHotkey}}==
AutoHotkey has both "Traditional" or literal text, and "Expression" mode.
This code demonstrates the task using both methods.
<lang AutoHotkey>;; Traditional
; Assign an empty string:
var =
; Check that a string is empty:
If var =
MsgBox the var is empty
; Check that a string is not empty
If var !=
Msgbox the var is not empty
 
 
;; Expression mode:
; Assign an empty string:
var := ""
; Check that a string is empty:
If (var = "")
MsgBox the var is empty
; Check that a string is not empty
If (var != "")
Msgbox the var is not empty</lang>
=={{header|C}}==
In C the strings are <code>char</code> pointers. A string terminates with the null char (U+0000, <code>'\0'</code>), which is not considered part of the string. Thus an empty string is <code>"\0"</code>, while a null string is a null pointer which points to nothing.