Content deleted Content added
Undid revision 1270374242 by Logoshimpo (talk) not how WP:BRD works, actually |
Hairy Dude (talk | contribs) →Use in programming languages: more on PowerShell Tags: Mobile edit Mobile web edit Advanced mobile edit |
||
(11 intermediate revisions by 8 users not shown) | |||
Line 2:
{{Short description|Unique string of length zero}}
{{Refimprove|date=November 2009}}
In [[formal language theory]], the '''empty string''',
==Formal theory<span class="anchor" id="nullable symbol"></span>==
Line 21:
==Use in programming languages==
In most [[programming language]]s, strings are a [[data type]]. Strings are typically stored at distinct [[memory address]]es (locations). Thus, the same string (
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.
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>''</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>‘’</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]]
|}
===
{{Expand section|date=March 2010}}
The empty string is a syntactically valid representation of [[
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
==See also==
|