Content deleted Content added
m Removed 'The' from the beginning of the short description per WP:SDFORMAT. (via WP:JWB) |
Jerryobject (talk | contribs) →Use in programming languages: WP:LINKs: updates, fix-cut needless WP:PIPEs (WP:NOPIPEs). Cut needless carriage returns in paragraphs. Small WP:EoS WP:TERSE WP:COPYEDITs. |
||
Line 20:
==Use in programming languages==
In most programming languages, strings are a [[data type]]. Strings are typically stored at distinct [[
In this way, there could be multiple empty strings in memory, in contrast with the formal theory definition, for which there is only one possible empty string. However, a string comparison function would indicate that all of these empty strings are equal to each other.
Even a string of length zero can require memory to store it, depending on the format being used. In most programming languages, the empty string is distinct from a [[null reference]] (or null pointer) because a null reference
<!---A null reference is likely to cause an error if one tries to perform any operation on it, but an empty string is less likely to do so.--->
The empty string is a legitimate string, upon which most string operations should work. Some languages treat some or all of the following in similar ways: empty strings, null references, the integer 0, the floating point number 0, the Boolean value [[False (logic)|false]], the [[ASCII]] character [[null character|NUL]], or other such values.
Line 37 ⟶ 35:
|-
| <code>""</code>
| [[C (programming language)|C]], [[C Sharp (programming language)|C#]], [[C++]], [[Go (programming language)|Go]], [[Haskell (programming language)|Haskell]], [[Java (programming language)|Java]], [[JavaScript]], [[Julia (programming language)|Julia]], [[Lua (programming language)|Lua]], [[MUMPS|M]], [[Objective-C]] (as a C string), [[OCaml]], [[Perl]], [[PHP]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Scala (programming language)|Scala]], [[Standard ML]], [[Swift (programming language)|Swift]], [[
|-
| <code>''</code>
| [[APL (programming language)|APL]], [[Delphi (programming language)|Delphi]], [[JavaScript]], [[
|-
| <code>{'\0'}</code>
|