Empty string: Difference between revisions

Content deleted Content added
No edit summary
Use in programming languages: more on PowerShell
Tags: Mobile edit Mobile web edit Advanced mobile edit
 
(5 intermediate revisions by 4 users not shown)
Line 2:
{{Short description|Unique string of length zero}}
{{Refimprove|date=November 2009}}
In [[formal language theory]], the '''empty string''', oralso known as the '''empty word''' or '''null string''', is the unique [[String (computer science)|string]] of length zero.
 
==Formal theory<span class="anchor" id="nullable symbol"></span>==
Line 39:
|-
| <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]], [[PowerShell]], [[Python (programming language)|Python]], [[Ruby (programming language)|Ruby]], [[Scala (programming language)|Scala]], [[Standard ML]], [[Swift (programming language)|Swift]], [[Tcl]], [[Visual Basic .NET]]
|-
| <code>&#39;&#39;</code>
| [[APL (programming language)|APL]], [[Delphi (programming language)|Delphi]], [[JavaScript]], [[Lua (programming language)|Lua]], [[MATLAB]], [[Pascal (programming language)|Pascal]], [[Perl]], [[PHP]], [[PowerShell]], [[Python (programming language)|Python]], [[R (programming language)|R]], [[Ruby (programming language)|Ruby]], [[Smalltalk]], [[SQL]]
|-
| <code>character(0)</code>
Line 65:
| [[Perl]]
|-
| <code>str()</code><ref>Another way to make an empty string is multiplying a string by 0 or a negative integer.</ref>
| <code>str()</code>
| [[Python (programming language)|Python]]
|-
Line 85:
| <code><nowiki>[[]]</nowiki></code>
| [[Lua (programming language)|Lua]]
|-
| <code>str()“”</code>
<code>‘’</code>
<code>„”</code>
<code>‚‘</code>{{refn|All 'smart' quotation marks work as both opening and closing marks in any combination, except that single marks must be paired with single marks and double marks with double marks. For example {{code|"Hello, world„}} is valid. Guillemets are not supported. Note that the German-style low single quotation mark given here is {{Unichar|201A}}; the similar-looking character {{Unichar|2C}} does not function as a quotation mark. PowerShell's official documentation recommends using straight quotation marks.<ref>{{cite web |url=https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.5 |title=about_Quoting_Rules – PowerShell |work=Microsoft Learn |access-date=26 August 2025 |url-status=live |archive-url=https://web.archive.org/web/20250814175659/https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-7.5 |archive-date=2025-08-14 |quote=PowerShell treats smart quotation marks, also called typographic or curly quotes, as normal quotation marks for strings. Don't use smart quotation marks to enclose strings.}}</ref>}}
|[[PowerShell]]
|}
 
=== Representations of the empty string ===
{{Expand section|date=March 2010}}
The empty string is a syntactically valid representation of [[0 (number)|zero]] in [[positional notation]] (in any base), which does not contain [[leading zero]]s. Since the empty string does not have a standard visual representation outside of formal language theory, the number zero is traditionally represented by a single [[decimal digit]] '''0''' instead.
 
Zero-filled memory area, interpreted as a [[null-terminated string]], is an empty string.
 
Empty lines of text show the empty string. This can occur from two consecutive [[End of line|EOLs]], as often occur in [[text file]]s,. and thisThis is sometimes used in [[text processing]] to separate [[paragraph]]s, e.g. in [[MediaWiki]].
 
==See also==
Line 100 ⟶ 106:
* [[Concatenation theory]]
* [[String literal]]
* [[0]]
 
==References==