Knowledge

Empty string

Source 📝

729: 36: 327:(or null pointer) because a null reference points to no string at all, not even the empty string. 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 160:
such as letters, digits or spaces. The empty string is the special case where the sequence has length zero, so there are no symbols in the string. There is only one empty string, because two strings are only different if they have different lengths or a different sequence of symbols. In formal
319:
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.
267: 771:. 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 323:
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
100: 342:
The empty string is usually represented similarly to other strings. In implementations with string terminating character (
72: 958: 119: 79: 198: 671: 388: 376: 57: 86: 631: 496: 484: 468: 428: 289: 53: 316:(locations). Thus, the same string (e.g.: the empty string) may be stored in two or more places in memory. 444: 436: 400: 963: 659: 647: 504: 432: 392: 228: 68: 346:
or plain text lines), the empty string is indicated by the immediate use of this terminating character.
711: 476: 464: 404: 953: 923: 384: 145: 740: 536: 524: 500: 372: 296:
to produce the empty string is known as an ε-production, and the symbol is said to be "nullable".
46: 822: 782: 343: 133: 894: 277: 827: 305: 285: 93: 8: 764: 219:ε = ε. Reversal of the empty string produces the empty string, so the empty string is a 877: 869: 157: 452: 350: 881: 861: 205: 797: 187: 905:
There are two ways to create "empty strings" in R; the other is listed here as
832: 788:
Empty lines of text show the empty string. This can occur from two consecutive
336: 324: 313: 293: 21: 947: 772: 328: 270: 209: 190:(i.e. a set of strings) that contains no strings, not even the empty string. 768: 852:
Corcoran, John; Frank, William; Maloney, Michael (1974). "String theory".
789: 602: 586: 544: 440: 412: 213: 728: 873: 760: 472: 396: 220: 817: 805: 801: 793: 508: 309: 865: 35: 913:
creates empty character vectors, which will output 0 when counted.
573: 353:
exist for checking if a string is empty in different languages.
182:
The empty string should not be confused with the empty language
675: 480: 687: 569: 557: 540: 416: 408: 380: 332: 183: 759:
The empty string is a syntactically valid representation of
619: 488: 420: 269:. Statements that are about all characters in a string are 175: 169: 163: 699: 512: 492: 448: 424: 231: 851: 156:
Formally, a string is a finite, ordered sequence of
60:. Unsourced material may be challenged and removed. 261: 276:The empty string precedes any other string under 20:" redirects here. For the printed character, see 945: 299: 161:treatments, the empty string is denoted with 719: 280:, because it is the shortest of all strings. 312:. Strings are typically stored at distinct 204:ε ⋅ s = s ⋅ ε = s. The empty string is the 781:Zero-filled memory area, interpreted as a 212:operation. The set of all strings forms a 349:Different functions, methods, macros, or 193:The empty string has several properties: 120:Learn how and when to remove this message 946: 767:(in any base), which does not contain 895:CSE1002 Lecture Notes – Lexicographic 723: 58:adding citations to reliable sources 29: 262:{\displaystyle \forall c\in s:P(c)} 13: 232: 14: 975: 796:, and this is sometimes used in 727: 151: 34: 45:needs additional citations for 924:"String in std::string - Rust" 916: 899: 888: 845: 256: 250: 1: 838: 300:Use in programming languages 27:Unique string of length zero 7: 811: 10: 980: 15: 959:String (computer science) 854:Journal of Symbolic Logic 720:Examples of empty strings 339:, or other such values. 216:with respect to ⋅ and ε. 344:null-terminated strings 823:Null-terminated string 785:, is an empty string. 783:null-terminated string 362:Programming languages 263: 134:formal language theory 306:programming languages 286:context-free grammars 278:lexicographical order 264: 828:Concatenation theory 792:, as often occur in 229: 54:improve this article 765:positional notation 964:Zero (linguistics) 739:. You can help by 259: 928:doc.rust-lang.org 757: 756: 717: 716: 683:String.make 0 '-' 676:Visual Basic .NET 453:Visual Basic .NET 415:(as a C string), 359:λ representation 130: 129: 122: 104: 971: 954:Formal languages 938: 937: 935: 934: 920: 914: 912: 908: 903: 897: 892: 886: 885: 849: 752: 749: 731: 724: 708: 696: 684: 668: 656: 644: 640: 628: 616: 608: 599: 592: 583: 566: 554: 547:(as a C string) 533: 521: 461: 369: 356: 355: 314:memory addresses 308:, strings are a 268: 266: 265: 260: 206:identity element 148:of length zero. 144:, is the unique 125: 118: 114: 111: 105: 103: 62: 38: 30: 19: 979: 978: 974: 973: 972: 970: 969: 968: 944: 943: 942: 941: 932: 930: 922: 921: 917: 910: 906: 904: 900: 893: 889: 866:10.2307/2272846 850: 846: 841: 814: 798:text processing 753: 747: 744: 737:needs expansion 722: 706: 694: 682: 666: 654: 642: 641: 638: 626: 614: 606: 598: 590: 589:(as a constant 581: 564: 552: 531: 519: 459: 367: 302: 290:production rule 230: 227: 226: 188:formal language 154: 126: 115: 109: 106: 63: 61: 51: 39: 28: 25: 17: 12: 11: 5: 977: 967: 966: 961: 956: 940: 939: 915: 898: 887: 860:(4): 625–637. 843: 842: 840: 837: 836: 835: 833:String literal 830: 825: 820: 813: 810: 755: 754: 734: 732: 721: 718: 715: 714: 709: 703: 702: 697: 691: 690: 685: 679: 678: 669: 663: 662: 657: 651: 650: 645: 635: 634: 629: 623: 622: 617: 611: 610: 600: 595: 594: 584: 578: 577: 567: 561: 560: 555: 549: 548: 534: 528: 527: 522: 516: 515: 462: 456: 455: 370: 364: 363: 360: 325:null reference 301: 298: 292:that allows a 282: 281: 274: 271:vacuously true 258: 255: 252: 249: 246: 243: 240: 237: 234: 224: 217: 202: 153: 150: 128: 127: 69:"Empty string" 42: 40: 33: 26: 22:Quotation mark 9: 6: 4: 3: 2: 976: 965: 962: 960: 957: 955: 952: 951: 949: 929: 925: 919: 902: 896: 891: 883: 879: 875: 871: 867: 863: 859: 855: 848: 844: 834: 831: 829: 826: 824: 821: 819: 816: 815: 809: 807: 803: 799: 795: 791: 786: 784: 779: 777: 774: 773:decimal digit 770: 769:leading zeros 766: 762: 751: 742: 738: 735:This section 733: 730: 726: 725: 713: 710: 705: 704: 701: 698: 693: 692: 689: 686: 681: 680: 677: 673: 670: 665: 664: 661: 658: 655:String::new() 653: 652: 649: 646: 637: 636: 633: 630: 625: 624: 621: 618: 613: 612: 604: 601: 597: 596: 588: 585: 580: 579: 575: 574:2014 standard 571: 568: 563: 562: 559: 556: 553:std::string() 551: 550: 546: 542: 538: 535: 530: 529: 526: 523: 518: 517: 514: 510: 506: 502: 498: 494: 490: 486: 482: 478: 474: 470: 466: 463: 458: 457: 454: 450: 446: 442: 438: 434: 430: 426: 422: 418: 414: 410: 406: 402: 398: 394: 390: 386: 382: 378: 374: 371: 366: 365: 361: 358: 357: 354: 352: 347: 345: 340: 338: 334: 330: 326: 321: 317: 315: 311: 307: 297: 295: 291: 287: 279: 275: 272: 253: 247: 244: 241: 238: 235: 225: 222: 218: 215: 211: 210:concatenation 207: 203: 200: 199:string length 197:|ε| = 0. Its 196: 195: 194: 191: 189: 186:, which is a 185: 180: 178: 177: 172: 171: 167:or sometimes 166: 165: 159: 152:Formal theory 149: 147: 143: 139: 135: 124: 121: 113: 110:November 2009 102: 99: 95: 92: 88: 85: 81: 78: 74: 71: –  70: 66: 65:Find sources: 59: 55: 49: 48: 43:This article 41: 37: 32: 31: 23: 931:. Retrieved 927: 918: 911:character(0) 901: 890: 857: 853: 847: 800:to separate 787: 780: 775: 758: 745: 741:adding to it 736: 667:string.Empty 520:character(0) 348: 341: 322: 318: 303: 283: 192: 181: 174: 168: 162: 155: 141: 138:empty string 137: 131: 116: 107: 97: 90: 83: 76: 64: 52:Please help 47:verification 44: 603:Objective-C 587:Objective-C 572:(since the 545:Objective-C 441:Standard ML 413:Objective-C 214:free monoid 948:Categories 933:2022-11-30 839:References 804:, e.g. in 802:paragraphs 794:text files 748:March 2010 605:(as a new 473:JavaScript 460:'' 397:JavaScript 335:character 221:palindrome 158:characters 142:empty word 80:newspapers 818:Empty set 806:MediaWiki 778:instead. 615:q(), qq() 509:Smalltalk 310:data type 239:∈ 233:∀ 812:See also 609:object) 607:NSString 593:object) 591:NSString 304:In most 201:is zero. 882:2168826 874:2272846 389:Haskell 208:of the 94:scholar 880:  872:  632:Python 532:{'\0'} 497:Python 485:Pascal 481:MATLAB 469:Delphi 429:Python 351:idioms 331:, the 294:symbol 146:string 136:, the 96:  89:  82:  75:  67:  878:S2CID 870:JSTOR 688:OCaml 627:str() 445:Swift 437:Scala 417:OCaml 401:Julia 333:ASCII 329:false 140:, or 101:JSTOR 87:books 790:EOLs 761:zero 660:Rust 648:Ruby 620:Perl 505:Ruby 489:Perl 433:Ruby 421:Perl 393:Java 288:, a 73:news 862:doi 763:in 743:. 712:Lua 700:Tcl 643:%() 639:%{} 582:@"" 570:C++ 565:""s 558:C++ 541:C++ 513:SQL 493:PHP 477:Lua 465:APL 449:Tcl 425:PHP 405:Lua 381:C++ 337:NUL 284:In 173:or 132:In 56:by 950:: 926:. 909:. 907:"" 876:. 868:. 858:39 856:. 808:. 695:{} 674:, 672:C# 576:) 543:, 539:, 511:, 507:, 503:, 499:, 495:, 491:, 487:, 483:, 479:, 475:, 471:, 467:, 451:, 447:, 443:, 439:, 435:, 431:, 427:, 423:, 419:, 411:, 407:, 403:, 399:, 395:, 391:, 387:, 385:Go 383:, 379:, 377:C# 375:, 368:"" 179:. 18:"" 936:. 884:. 864:: 776:0 750:) 746:( 707:] 537:C 525:R 501:R 409:M 373:C 273:. 257:) 254:c 251:( 248:P 245:: 242:s 236:c 223:. 184:∅ 176:λ 170:Λ 164:ε 123:) 117:( 112:) 108:( 98:· 91:· 84:· 77:· 50:. 24:. 16:"

Index

Quotation mark

verification
improve this article
adding citations to reliable sources
"Empty string"
news
newspapers
books
scholar
JSTOR
Learn how and when to remove this message
formal language theory
string
characters
ε
Λ
λ

formal language
string length
identity element
concatenation
free monoid
palindrome
vacuously true
lexicographical order
context-free grammars
production rule
symbol

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.