CINXE.COM
String (computer science) - Wikipedia
<!DOCTYPE html> <html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available" lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>String (computer science) - Wikipedia</title> <script>(function(){var className="client-js vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-sticky-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-feature-night-mode-enabled skin-theme-clientpref-day vector-toc-available";var cookie=document.cookie.match(/(?:^|; )enwikimwclientpreferences=([^;]+)/);if(cookie){cookie[1].split('%2C').forEach(function(pref){className=className.replace(new RegExp('(^| )'+pref.replace(/-clientpref-\w+$|[^\w-]+/g,'')+'-clientpref-\\w+( |$)'),'$1'+pref+'$2');});}document.documentElement.className=className;}());RLCONF={"wgBreakFrames":false,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy", "wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"095ef6a8-af65-496a-a365-4e1edbf13d68","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"String_(computer_science)","wgTitle":"String (computer science)","wgCurRevisionId":1260782846,"wgRevisionId":1260782846,"wgArticleId":27701,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["CS1 maint: unfit URL","Webarchive template wayback links","CS1 maint: location missing publisher","Articles with short description","Short description is different from Wikidata","Wikipedia articles needing clarification from June 2015","String (computer science)","Character encoding","Data types","Formal languages","Combinatorics on words","Primitive types","Syntactic entities","Algorithms on strings"],"wgPageViewLanguage":"en","wgPageContentLanguage":"en", "wgPageContentModel":"wikitext","wgRelevantPageName":"String_(computer_science)","wgRelevantArticleId":27701,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgRedirectedFrom":"String_(computing)","wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":false,"wgFlaggedRevsParams":{"tags":{"status":{"levels":1}}},"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true,"wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":false,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":40000,"wgInternalRedirectTargetUrl":"/wiki/String_(computer_science)","wgRelatedArticlesCompat":[],"wgEditSubmitButtonLabelPublish":true,"wgULSPosition":"interlanguage","wgULSisCompactLinksEnabled":false,"wgVector2022LanguageInHeader":true,"wgULSisLanguageSelectorEmpty":false ,"wgWikibaseItemId":"Q184754","wgCheckUserClientHintsHeadersJsApi":["brands","architecture","bitness","fullVersionList","mobile","model","platform","platformVersion"],"GEHomepageSuggestedEditsEnableTopics":true,"wgGETopicsMatchModeEnabled":false,"wgGEStructuredTaskRejectionReasonTextInputEnabled":false,"wgGELevelingUpEnabledForUser":false};RLSTATE={"ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready","user.options":"loading","ext.cite.styles":"ready","ext.pygments":"ready","ext.math.styles":"ready","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","jquery.makeCollapsible.styles":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["mediawiki.action.view.redirect","ext.cite.ux-enhancements", "ext.pygments.view","mediawiki.page.media","site","mediawiki.page.ready","jquery.makeCollapsible","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.gadget.ReferenceTooltips","ext.gadget.switcher","ext.urlShortener.toolbar","ext.centralauth.centralautologin","mmv.bootstrap","ext.popups","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader","ext.echo.centralauth","ext.eventLogging","ext.wikimediaEvents","ext.navigationTiming","ext.uls.interface","ext.cx.eventlogging.campaigns","ext.cx.uls.quick.actions","wikibase.client.vector-2022","ext.checkUser.clientHints","ext.quicksurveys.init","ext.growthExperiments.SuggestedEditSession","wikibase.sidebar.tracking"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.impl(function(){return["user.options@12s5i",function($,jQuery,require,module){mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); }];});});</script> <link rel="stylesheet" href="/w/load.php?lang=en&modules=ext.cite.styles%7Cext.math.styles%7Cext.pygments%2CwikimediaBadges%7Cext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediamessages.styles%7Cjquery.makeCollapsible.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&only=styles&skin=vector-2022"> <script async="" src="/w/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=en&modules=site.styles&only=styles&skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.5"> <meta name="referrer" content="origin"> <meta name="referrer" content="origin-when-cross-origin"> <meta name="robots" content="max-image-preview:standard"> <meta name="format-detection" content="telephone=no"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/6/6b/String_example.png"> <meta property="og:image:width" content="1200"> <meta property="og:image:height" content="640"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/6/6b/String_example.png"> <meta property="og:image:width" content="800"> <meta property="og:image:height" content="427"> <meta property="og:image" content="https://upload.wikimedia.org/wikipedia/commons/thumb/6/6b/String_example.png/640px-String_example.png"> <meta property="og:image:width" content="640"> <meta property="og:image:height" content="341"> <meta name="viewport" content="width=1120"> <meta property="og:title" content="String (computer science) - Wikipedia"> <meta property="og:type" content="website"> <link rel="preconnect" href="//upload.wikimedia.org"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//en.m.wikipedia.org/wiki/String_(computer_science)"> <link rel="alternate" type="application/x-wiki" title="Edit this page" href="/w/index.php?title=String_(computer_science)&action=edit"> <link rel="apple-touch-icon" href="/static/apple-touch/wikipedia.png"> <link rel="icon" href="/static/favicon/wikipedia.ico"> <link rel="search" type="application/opensearchdescription+xml" href="/w/rest.php/v1/search" title="Wikipedia (en)"> <link rel="EditURI" type="application/rsd+xml" href="//en.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://en.wikipedia.org/wiki/String_(computer_science)"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom feed" href="/w/index.php?title=Special:RecentChanges&feed=atom"> <link rel="dns-prefetch" href="//meta.wikimedia.org" /> <link rel="dns-prefetch" href="//login.wikimedia.org"> </head> <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject mw-editable page-String_computer_science rootpage-String_computer_science skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Jump to content</a> <div class="vector-header-container"> <header class="vector-header mw-header"> <div class="vector-header-start"> <nav class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-dropdown" class="vector-dropdown vector-main-menu-dropdown vector-button-flush-left vector-button-flush-right" > <input type="checkbox" id="vector-main-menu-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-main-menu-dropdown" class="vector-dropdown-checkbox " aria-label="Main menu" > <label id="vector-main-menu-dropdown-label" for="vector-main-menu-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-menu mw-ui-icon-wikimedia-menu"></span> <span class="vector-dropdown-label-text">Main menu</span> </label> <div class="vector-dropdown-content"> <div id="vector-main-menu-unpinned-container" class="vector-unpinned-container"> <div id="vector-main-menu" class="vector-main-menu vector-pinnable-element"> <div class="vector-pinnable-header vector-main-menu-pinnable-header vector-pinnable-header-unpinned" data-feature-name="main-menu-pinned" data-pinnable-element-id="vector-main-menu" data-pinned-container-id="vector-main-menu-pinned-container" data-unpinned-container-id="vector-main-menu-unpinned-container" > <div class="vector-pinnable-header-label">Main menu</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">hide</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Navigation </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage-description" class="mw-list-item"><a href="/wiki/Main_Page" title="Visit the main page [z]" accesskey="z"><span>Main page</span></a></li><li id="n-contents" class="mw-list-item"><a href="/wiki/Wikipedia:Contents" title="Guides to browsing Wikipedia"><span>Contents</span></a></li><li id="n-currentevents" class="mw-list-item"><a href="/wiki/Portal:Current_events" title="Articles related to current events"><span>Current events</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Special:Random" title="Visit a randomly selected article [x]" accesskey="x"><span>Random article</span></a></li><li id="n-aboutsite" class="mw-list-item"><a href="/wiki/Wikipedia:About" title="Learn about Wikipedia and how it works"><span>About Wikipedia</span></a></li><li id="n-contactpage" class="mw-list-item"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us" title="How to contact Wikipedia"><span>Contact us</span></a></li> </ul> </div> </div> <div id="p-interaction" class="vector-menu mw-portlet mw-portlet-interaction" > <div class="vector-menu-heading"> Contribute </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-help" class="mw-list-item"><a href="/wiki/Help:Contents" title="Guidance on how to use and edit Wikipedia"><span>Help</span></a></li><li id="n-introduction" class="mw-list-item"><a href="/wiki/Help:Introduction" title="Learn how to edit Wikipedia"><span>Learn to edit</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Community_portal" title="The hub for editors"><span>Community portal</span></a></li><li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Special:RecentChanges" title="A list of recent changes to Wikipedia [r]" accesskey="r"><span>Recent changes</span></a></li><li id="n-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_upload_wizard" title="Add images or other media for use on Wikipedia"><span>Upload file</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Main_Page" class="mw-logo"> <img class="mw-logo-icon" src="/static/images/icons/wikipedia.png" alt="" aria-hidden="true" height="50" width="50"> <span class="mw-logo-container skin-invert"> <img class="mw-logo-wordmark" alt="Wikipedia" src="/static/images/mobile/copyright/wikipedia-wordmark-en.svg" style="width: 7.5em; height: 1.125em;"> <img class="mw-logo-tagline" alt="The Free Encyclopedia" src="/static/images/mobile/copyright/wikipedia-tagline-en.svg" width="117" height="13" style="width: 7.3125em; height: 0.8125em;"> </span> </a> </div> <div class="vector-header-end"> <div id="p-search" role="search" class="vector-search-box-vue vector-search-box-collapses vector-search-box-show-thumbnail vector-search-box-auto-expand-width vector-search-box"> <a href="/wiki/Special:Search" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Search Wikipedia [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Search</span> </a> <div class="vector-typeahead-search-container"> <div class="cdx-typeahead-search cdx-typeahead-search--show-thumbnail cdx-typeahead-search--auto-expand-width"> <form action="/w/index.php" id="searchform" class="cdx-search-input cdx-search-input--has-end-button"> <div id="simpleSearch" class="cdx-search-input__input-wrapper" data-search-loc="header-moved"> <div class="cdx-text-input cdx-text-input--has-start-icon"> <input class="cdx-text-input__input" type="search" name="search" placeholder="Search Wikipedia" aria-label="Search Wikipedia" autocapitalize="sentences" title="Search Wikipedia [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Special:Search"> </div> <button class="cdx-button cdx-search-input__end-button">Search</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Personal tools"> <div class="vector-user-links-main"> <div id="p-vector-user-menu-preferences" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-userpage" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Change the appearance of the page's font size, width, and color" > <input type="checkbox" id="vector-appearance-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-appearance-dropdown" class="vector-dropdown-checkbox " aria-label="Appearance" > <label id="vector-appearance-dropdown-label" for="vector-appearance-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-appearance mw-ui-icon-wikimedia-appearance"></span> <span class="vector-dropdown-label-text">Appearance</span> </label> <div class="vector-dropdown-content"> <div id="vector-appearance-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <div id="p-vector-user-menu-notifications" class="vector-menu mw-portlet emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> <div id="p-vector-user-menu-overflow" class="vector-menu mw-portlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en" class=""><span>Donate</span></a> </li> <li id="pt-createaccount-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:CreateAccount&returnto=String+%28computer+science%29" title="You are encouraged to create an account and log in; however, it is not mandatory" class=""><span>Create account</span></a> </li> <li id="pt-login-2" class="user-links-collapsible-item mw-list-item user-links-collapsible-item"><a data-mw="interface" href="/w/index.php?title=Special:UserLogin&returnto=String+%28computer+science%29" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o" class=""><span>Log in</span></a> </li> </ul> </div> </div> </div> <div id="vector-user-links-dropdown" class="vector-dropdown vector-user-menu vector-button-flush-right vector-user-menu-logged-out" title="Log in and more options" > <input type="checkbox" id="vector-user-links-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-user-links-dropdown" class="vector-dropdown-checkbox " aria-label="Personal tools" > <label id="vector-user-links-dropdown-label" for="vector-user-links-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-ellipsis mw-ui-icon-wikimedia-ellipsis"></span> <span class="vector-dropdown-label-text">Personal tools</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal user-links-collapsible-item" title="User menu" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-sitesupport" class="user-links-collapsible-item mw-list-item"><a href="https://donate.wikimedia.org/wiki/Special:FundraiserRedirector?utm_source=donate&utm_medium=sidebar&utm_campaign=C13_en.wikipedia.org&uselang=en"><span>Donate</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:CreateAccount&returnto=String+%28computer+science%29" title="You are encouraged to create an account and log in; however, it is not mandatory"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Create account</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Special:UserLogin&returnto=String+%28computer+science%29" title="You're encouraged to log in; however, it's not mandatory. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Log in</span></a></li> </ul> </div> </div> <div id="p-user-menu-anon-editor" class="vector-menu mw-portlet mw-portlet-user-menu-anon-editor" > <div class="vector-menu-heading"> Pages for logged out editors <a href="/wiki/Help:Introduction" aria-label="Learn more about editing"><span>learn more</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anoncontribs" class="mw-list-item"><a href="/wiki/Special:MyContributions" title="A list of edits made from this IP address [y]" accesskey="y"><span>Contributions</span></a></li><li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Special:MyTalk" title="Discussion about edits from this IP address [n]" accesskey="n"><span>Talk</span></a></li> </ul> </div> </div> </div> </div> </nav> </div> </header> </div> <div class="mw-page-container"> <div class="mw-page-container-inner"> <div class="vector-sitenotice-container"> <div id="siteNotice"><!-- CentralNotice --></div> </div> <div class="vector-column-start"> <div class="vector-main-menu-container"> <div id="mw-navigation"> <nav id="mw-panel" class="vector-main-menu-landmark" aria-label="Site"> <div id="vector-main-menu-pinned-container" class="vector-pinned-container"> </div> </nav> </div> </div> <div class="vector-sticky-pinned-container"> <nav id="mw-panel-toc" aria-label="Contents" data-event-name="ui.sidebar-toc" class="mw-table-of-contents-container vector-toc-landmark"> <div id="vector-toc-pinned-container" class="vector-pinned-container"> <div id="vector-toc" class="vector-toc vector-pinnable-element"> <div class="vector-pinnable-header vector-toc-pinnable-header vector-pinnable-header-pinned" data-feature-name="toc-pinned" data-pinnable-element-id="vector-toc" > <h2 class="vector-pinnable-header-label">Contents</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">hide</button> </div> <ul class="vector-toc-contents" id="mw-panel-toc-list"> <li id="toc-mw-content-text" class="vector-toc-list-item vector-toc-level-1"> <a href="#" class="vector-toc-link"> <div class="vector-toc-text">(Top)</div> </a> </li> <li id="toc-Purpose" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Purpose"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Purpose</span> </div> </a> <ul id="toc-Purpose-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-History" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#History"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>History</span> </div> </a> <ul id="toc-History-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-String_datatypes" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#String_datatypes"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>String datatypes</span> </div> </a> <button aria-controls="toc-String_datatypes-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle String datatypes subsection</span> </button> <ul id="toc-String_datatypes-sublist" class="vector-toc-list"> <li id="toc-String_length" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#String_length"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.1</span> <span>String length</span> </div> </a> <ul id="toc-String_length-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Character_encoding" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Character_encoding"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.2</span> <span>Character encoding</span> </div> </a> <ul id="toc-Character_encoding-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Implementations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Implementations"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.3</span> <span>Implementations</span> </div> </a> <ul id="toc-Implementations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Representations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Representations"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4</span> <span>Representations</span> </div> </a> <ul id="toc-Representations-sublist" class="vector-toc-list"> <li id="toc-Null-terminated" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Null-terminated"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.1</span> <span>Null-terminated</span> </div> </a> <ul id="toc-Null-terminated-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Byte-_and_bit-terminated" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Byte-_and_bit-terminated"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.2</span> <span>Byte- and bit-terminated</span> </div> </a> <ul id="toc-Byte-_and_bit-terminated-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Length-prefixed" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Length-prefixed"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.3</span> <span>Length-prefixed</span> </div> </a> <ul id="toc-Length-prefixed-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Strings_as_records" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Strings_as_records"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.4</span> <span>Strings as records</span> </div> </a> <ul id="toc-Strings_as_records-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Other_representations" class="vector-toc-list-item vector-toc-level-3"> <a class="vector-toc-link" href="#Other_representations"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.4.5</span> <span>Other representations</span> </div> </a> <ul id="toc-Other_representations-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Security_concerns" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Security_concerns"> <div class="vector-toc-text"> <span class="vector-toc-numb">3.5</span> <span>Security concerns</span> </div> </a> <ul id="toc-Security_concerns-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-Literal_strings" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Literal_strings"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Literal strings</span> </div> </a> <ul id="toc-Literal_strings-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Non-text_strings" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Non-text_strings"> <div class="vector-toc-text"> <span class="vector-toc-numb">5</span> <span>Non-text strings</span> </div> </a> <ul id="toc-Non-text_strings-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-String_processing_algorithms" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#String_processing_algorithms"> <div class="vector-toc-text"> <span class="vector-toc-numb">6</span> <span>String processing algorithms</span> </div> </a> <ul id="toc-String_processing_algorithms-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Character_string-oriented_languages_and_utilities" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Character_string-oriented_languages_and_utilities"> <div class="vector-toc-text"> <span class="vector-toc-numb">7</span> <span>Character string-oriented languages and utilities</span> </div> </a> <ul id="toc-Character_string-oriented_languages_and_utilities-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Character_string_functions" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Character_string_functions"> <div class="vector-toc-text"> <span class="vector-toc-numb">8</span> <span>Character string functions</span> </div> </a> <ul id="toc-Character_string_functions-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Formal_theory" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#Formal_theory"> <div class="vector-toc-text"> <span class="vector-toc-numb">9</span> <span>Formal theory</span> </div> </a> <button aria-controls="toc-Formal_theory-sublist" class="cdx-button cdx-button--weight-quiet cdx-button--icon-only vector-toc-toggle"> <span class="vector-icon mw-ui-icon-wikimedia-expand"></span> <span>Toggle Formal theory subsection</span> </button> <ul id="toc-Formal_theory-sublist" class="vector-toc-list"> <li id="toc-Concatenation_and_substrings" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Concatenation_and_substrings"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.1</span> <span>Concatenation and substrings</span> </div> </a> <ul id="toc-Concatenation_and_substrings-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Prefixes_and_suffixes" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Prefixes_and_suffixes"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.2</span> <span>Prefixes and suffixes</span> </div> </a> <ul id="toc-Prefixes_and_suffixes-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Reversal" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Reversal"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.3</span> <span>Reversal</span> </div> </a> <ul id="toc-Reversal-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Rotations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Rotations"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.4</span> <span>Rotations</span> </div> </a> <ul id="toc-Rotations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Lexicographical_ordering" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Lexicographical_ordering"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.5</span> <span>Lexicographical ordering</span> </div> </a> <ul id="toc-Lexicographical_ordering-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-String_operations" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#String_operations"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.6</span> <span>String operations</span> </div> </a> <ul id="toc-String_operations-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Topology" class="vector-toc-list-item vector-toc-level-2"> <a class="vector-toc-link" href="#Topology"> <div class="vector-toc-text"> <span class="vector-toc-numb">9.7</span> <span>Topology</span> </div> </a> <ul id="toc-Topology-sublist" class="vector-toc-list"> </ul> </li> </ul> </li> <li id="toc-See_also" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#See_also"> <div class="vector-toc-text"> <span class="vector-toc-numb">10</span> <span>See also</span> </div> </a> <ul id="toc-See_also-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-References" class="vector-toc-list-item vector-toc-level-1"> <a class="vector-toc-link" href="#References"> <div class="vector-toc-text"> <span class="vector-toc-numb">11</span> <span>References</span> </div> </a> <ul id="toc-References-sublist" class="vector-toc-list"> </ul> </li> </ul> </div> </div> </nav> </div> </div> <div class="mw-content-container"> <main id="content" class="mw-body"> <header class="mw-body-header vector-page-titlebar"> <nav aria-label="Contents" class="vector-toc-landmark"> <div id="vector-page-titlebar-toc" class="vector-dropdown vector-page-titlebar-toc vector-button-flush-left" > <input type="checkbox" id="vector-page-titlebar-toc-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-titlebar-toc" class="vector-dropdown-checkbox " aria-label="Toggle the table of contents" > <label id="vector-page-titlebar-toc-label" for="vector-page-titlebar-toc-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only " aria-hidden="true" ><span class="vector-icon mw-ui-icon-listBullet mw-ui-icon-wikimedia-listBullet"></span> <span class="vector-dropdown-label-text">Toggle the table of contents</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-titlebar-toc-unpinned-container" class="vector-unpinned-container"> </div> </div> </div> </nav> <h1 id="firstHeading" class="firstHeading mw-first-heading"><span class="mw-page-title-main">String (computer science)</span></h1> <div id="p-lang-btn" class="vector-dropdown mw-portlet mw-portlet-lang" > <input type="checkbox" id="p-lang-btn-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-p-lang-btn" class="vector-dropdown-checkbox mw-interlanguage-selector" aria-label="Go to an article in another language. Available in 43 languages" > <label id="p-lang-btn-label" for="p-lang-btn-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--action-progressive mw-portlet-lang-heading-43" aria-hidden="true" ><span class="vector-icon mw-ui-icon-language-progressive mw-ui-icon-wikimedia-language-progressive"></span> <span class="vector-dropdown-label-text">43 languages</span> </label> <div class="vector-dropdown-content"> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="interlanguage-link interwiki-af mw-list-item"><a href="https://af.wikipedia.org/wiki/String_(rekenaarwetenskap)" title="String (rekenaarwetenskap) – Afrikaans" lang="af" hreflang="af" data-title="String (rekenaarwetenskap)" data-language-autonym="Afrikaans" data-language-local-name="Afrikaans" class="interlanguage-link-target"><span>Afrikaans</span></a></li><li class="interlanguage-link interwiki-ar mw-list-item"><a href="https://ar.wikipedia.org/wiki/%D8%B3%D9%84%D8%B3%D9%84%D8%A9_(%D8%B9%D9%84%D9%85_%D8%A7%D9%84%D8%AD%D8%A7%D8%B3%D9%88%D8%A8)" title="سلسلة (علم الحاسوب) – Arabic" lang="ar" hreflang="ar" data-title="سلسلة (علم الحاسوب)" data-language-autonym="العربية" data-language-local-name="Arabic" class="interlanguage-link-target"><span>العربية</span></a></li><li class="interlanguage-link interwiki-zh-min-nan mw-list-item"><a href="https://zh-min-nan.wikipedia.org/wiki/J%C4%AB-lia%CC%8Dt" title="Jī-lia̍t – Minnan" lang="nan" hreflang="nan" data-title="Jī-lia̍t" data-language-autonym="閩南語 / Bân-lâm-gú" data-language-local-name="Minnan" class="interlanguage-link-target"><span>閩南語 / Bân-lâm-gú</span></a></li><li class="interlanguage-link interwiki-be mw-list-item"><a href="https://be.wikipedia.org/wiki/%D0%A0%D0%B0%D0%B4%D0%BA%D0%BE%D0%B2%D1%8B_%D1%82%D1%8B%D0%BF" title="Радковы тып – Belarusian" lang="be" hreflang="be" data-title="Радковы тып" data-language-autonym="Беларуская" data-language-local-name="Belarusian" class="interlanguage-link-target"><span>Беларуская</span></a></li><li class="interlanguage-link interwiki-bg mw-list-item"><a href="https://bg.wikipedia.org/wiki/%D0%9D%D0%B8%D0%B7" title="Низ – Bulgarian" lang="bg" hreflang="bg" data-title="Низ" data-language-autonym="Български" data-language-local-name="Bulgarian" class="interlanguage-link-target"><span>Български</span></a></li><li class="interlanguage-link interwiki-ca mw-list-item"><a href="https://ca.wikipedia.org/wiki/Cadena_(inform%C3%A0tica)" title="Cadena (informàtica) – Catalan" lang="ca" hreflang="ca" data-title="Cadena (informàtica)" data-language-autonym="Català" data-language-local-name="Catalan" class="interlanguage-link-target"><span>Català</span></a></li><li class="interlanguage-link interwiki-cs mw-list-item"><a href="https://cs.wikipedia.org/wiki/Textov%C3%BD_%C5%99et%C4%9Bzec" title="Textový řetězec – Czech" lang="cs" hreflang="cs" data-title="Textový řetězec" data-language-autonym="Čeština" data-language-local-name="Czech" class="interlanguage-link-target"><span>Čeština</span></a></li><li class="interlanguage-link interwiki-da mw-list-item"><a href="https://da.wikipedia.org/wiki/Tekststreng" title="Tekststreng – Danish" lang="da" hreflang="da" data-title="Tekststreng" data-language-autonym="Dansk" data-language-local-name="Danish" class="interlanguage-link-target"><span>Dansk</span></a></li><li class="interlanguage-link interwiki-de mw-list-item"><a href="https://de.wikipedia.org/wiki/Zeichenkette" title="Zeichenkette – German" lang="de" hreflang="de" data-title="Zeichenkette" data-language-autonym="Deutsch" data-language-local-name="German" class="interlanguage-link-target"><span>Deutsch</span></a></li><li class="interlanguage-link interwiki-et mw-list-item"><a href="https://et.wikipedia.org/wiki/S%C3%B5ne_(andmet%C3%BC%C3%BCp)" title="Sõne (andmetüüp) – Estonian" lang="et" hreflang="et" data-title="Sõne (andmetüüp)" data-language-autonym="Eesti" data-language-local-name="Estonian" class="interlanguage-link-target"><span>Eesti</span></a></li><li class="interlanguage-link interwiki-el mw-list-item"><a href="https://el.wikipedia.org/wiki/%CE%A3%CF%85%CE%BC%CE%B2%CE%BF%CE%BB%CE%BF%CF%83%CE%B5%CE%B9%CF%81%CE%AC" title="Συμβολοσειρά – Greek" lang="el" hreflang="el" data-title="Συμβολοσειρά" data-language-autonym="Ελληνικά" data-language-local-name="Greek" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-es mw-list-item"><a href="https://es.wikipedia.org/wiki/Cadena_de_caracteres" title="Cadena de caracteres – Spanish" lang="es" hreflang="es" data-title="Cadena de caracteres" data-language-autonym="Español" data-language-local-name="Spanish" class="interlanguage-link-target"><span>Español</span></a></li><li class="interlanguage-link interwiki-eo mw-list-item"><a href="https://eo.wikipedia.org/wiki/Signo%C4%89eno" title="Signoĉeno – Esperanto" lang="eo" hreflang="eo" data-title="Signoĉeno" data-language-autonym="Esperanto" data-language-local-name="Esperanto" class="interlanguage-link-target"><span>Esperanto</span></a></li><li class="interlanguage-link interwiki-fa mw-list-item"><a href="https://fa.wikipedia.org/wiki/%D8%B1%D8%B4%D8%AA%D9%87_(%D8%B9%D9%84%D9%88%D9%85_%D8%B1%D8%A7%DB%8C%D8%A7%D9%86%D9%87)" title="رشته (علوم رایانه) – Persian" lang="fa" hreflang="fa" data-title="رشته (علوم رایانه)" data-language-autonym="فارسی" data-language-local-name="Persian" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fr mw-list-item"><a href="https://fr.wikipedia.org/wiki/Cha%C3%AEne_de_caract%C3%A8res" title="Chaîne de caractères – French" lang="fr" hreflang="fr" data-title="Chaîne de caractères" data-language-autonym="Français" data-language-local-name="French" class="interlanguage-link-target"><span>Français</span></a></li><li class="interlanguage-link interwiki-ko mw-list-item"><a href="https://ko.wikipedia.org/wiki/%EB%AC%B8%EC%9E%90%EC%97%B4" title="문자열 – Korean" lang="ko" hreflang="ko" data-title="문자열" data-language-autonym="한국어" data-language-local-name="Korean" class="interlanguage-link-target"><span>한국어</span></a></li><li class="interlanguage-link interwiki-hi mw-list-item"><a href="https://hi.wikipedia.org/wiki/%E0%A4%B8%E0%A5%8D%E0%A4%9F%E0%A5%8D%E0%A4%B0%E0%A4%BF%E0%A4%82%E0%A4%97_(%E0%A4%B8%E0%A4%82%E0%A4%97%E0%A4%A3%E0%A4%A8)" title="स्ट्रिंग (संगणन) – Hindi" lang="hi" hreflang="hi" data-title="स्ट्रिंग (संगणन)" data-language-autonym="हिन्दी" data-language-local-name="Hindi" class="interlanguage-link-target"><span>हिन्दी</span></a></li><li class="interlanguage-link interwiki-io mw-list-item"><a href="https://io.wikipedia.org/wiki/Signokateno" title="Signokateno – Ido" lang="io" hreflang="io" data-title="Signokateno" data-language-autonym="Ido" data-language-local-name="Ido" class="interlanguage-link-target"><span>Ido</span></a></li><li class="interlanguage-link interwiki-id mw-list-item"><a href="https://id.wikipedia.org/wiki/Untaian" title="Untaian – Indonesian" lang="id" hreflang="id" data-title="Untaian" data-language-autonym="Bahasa Indonesia" data-language-local-name="Indonesian" class="interlanguage-link-target"><span>Bahasa Indonesia</span></a></li><li class="interlanguage-link interwiki-is mw-list-item"><a href="https://is.wikipedia.org/wiki/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)" title="Strengur (tölvunarfræði) – Icelandic" lang="is" hreflang="is" data-title="Strengur (tölvunarfræði)" data-language-autonym="Íslenska" data-language-local-name="Icelandic" class="interlanguage-link-target"><span>Íslenska</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Stringa_(informatica)" title="Stringa (informatica) – Italian" lang="it" hreflang="it" data-title="Stringa (informatica)" data-language-autonym="Italiano" data-language-local-name="Italian" class="interlanguage-link-target"><span>Italiano</span></a></li><li class="interlanguage-link interwiki-he mw-list-item"><a href="https://he.wikipedia.org/wiki/%D7%9E%D7%97%D7%A8%D7%95%D7%96%D7%AA_(%D7%9E%D7%93%D7%A2%D7%99_%D7%94%D7%9E%D7%97%D7%A9%D7%91)" title="מחרוזת (מדעי המחשב) – Hebrew" lang="he" hreflang="he" data-title="מחרוזת (מדעי המחשב)" data-language-autonym="עברית" data-language-local-name="Hebrew" class="interlanguage-link-target"><span>עברית</span></a></li><li class="interlanguage-link interwiki-hu mw-list-item"><a href="https://hu.wikipedia.org/wiki/String" title="String – Hungarian" lang="hu" hreflang="hu" data-title="String" data-language-autonym="Magyar" data-language-local-name="Hungarian" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-mk mw-list-item"><a href="https://mk.wikipedia.org/wiki/%D0%9D%D0%B8%D0%B7%D0%B0_(%D0%B8%D0%BD%D1%84%D0%BE%D1%80%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D0%B0)" title="Низа (информатика) – Macedonian" lang="mk" hreflang="mk" data-title="Низа (информатика)" data-language-autonym="Македонски" data-language-local-name="Macedonian" class="interlanguage-link-target"><span>Македонски</span></a></li><li class="interlanguage-link interwiki-ml mw-list-item"><a href="https://ml.wikipedia.org/wiki/%E0%B4%85%E0%B4%95%E0%B5%8D%E0%B4%B7%E0%B4%B0%E0%B4%B6%E0%B5%83%E0%B4%82%E0%B4%96%E0%B4%B2_(%E0%B4%95%E0%B4%AE%E0%B5%8D%E0%B4%AA%E0%B5%8D%E0%B4%AF%E0%B5%82%E0%B4%9F%E0%B5%8D%E0%B4%9F%E0%B5%BC_%E0%B4%B6%E0%B4%BE%E0%B4%B8%E0%B5%8D%E0%B4%A4%E0%B5%8D%E0%B4%B0%E0%B4%82)" title="അക്ഷരശൃംഖല (കമ്പ്യൂട്ടർ ശാസ്ത്രം) – Malayalam" lang="ml" hreflang="ml" data-title="അക്ഷരശൃംഖല (കമ്പ്യൂട്ടർ ശാസ്ത്രം)" data-language-autonym="മലയാളം" data-language-local-name="Malayalam" class="interlanguage-link-target"><span>മലയാളം</span></a></li><li class="interlanguage-link interwiki-ms mw-list-item"><a href="https://ms.wikipedia.org/wiki/Rentetan" title="Rentetan – Malay" lang="ms" hreflang="ms" data-title="Rentetan" data-language-autonym="Bahasa Melayu" data-language-local-name="Malay" class="interlanguage-link-target"><span>Bahasa Melayu</span></a></li><li class="interlanguage-link interwiki-nl mw-list-item"><a href="https://nl.wikipedia.org/wiki/Tekenreeks" title="Tekenreeks – Dutch" lang="nl" hreflang="nl" data-title="Tekenreeks" data-language-autonym="Nederlands" data-language-local-name="Dutch" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-ja mw-list-item"><a href="https://ja.wikipedia.org/wiki/%E6%96%87%E5%AD%97%E5%88%97" title="文字列 – Japanese" lang="ja" hreflang="ja" data-title="文字列" data-language-autonym="日本語" data-language-local-name="Japanese" class="interlanguage-link-target"><span>日本語</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Streng_(informatikk)" title="Streng (informatikk) – Norwegian Bokmål" lang="nb" hreflang="nb" data-title="Streng (informatikk)" data-language-autonym="Norsk bokmål" data-language-local-name="Norwegian Bokmål" class="interlanguage-link-target"><span>Norsk bokmål</span></a></li><li class="interlanguage-link interwiki-pl mw-list-item"><a href="https://pl.wikipedia.org/wiki/Tekstowy_typ_danych" title="Tekstowy typ danych – Polish" lang="pl" hreflang="pl" data-title="Tekstowy typ danych" data-language-autonym="Polski" data-language-local-name="Polish" class="interlanguage-link-target"><span>Polski</span></a></li><li class="interlanguage-link interwiki-pt mw-list-item"><a href="https://pt.wikipedia.org/wiki/Cadeia_de_caracteres" title="Cadeia de caracteres – Portuguese" lang="pt" hreflang="pt" data-title="Cadeia de caracteres" data-language-autonym="Português" data-language-local-name="Portuguese" class="interlanguage-link-target"><span>Português</span></a></li><li class="interlanguage-link interwiki-ru mw-list-item"><a href="https://ru.wikipedia.org/wiki/%D0%A1%D1%82%D1%80%D0%BE%D0%BA%D0%BE%D0%B2%D1%8B%D0%B9_%D1%82%D0%B8%D0%BF" title="Строковый тип – Russian" lang="ru" hreflang="ru" data-title="Строковый тип" data-language-autonym="Русский" data-language-local-name="Russian" class="interlanguage-link-target"><span>Русский</span></a></li><li class="interlanguage-link interwiki-ckb mw-list-item"><a href="https://ckb.wikipedia.org/wiki/%D8%B2%D9%86%D8%AC%DB%8C%D8%B1%DB%95%D9%86%D9%88%D9%88%D8%B3%DB%95" title="زنجیرەنووسە – Central Kurdish" lang="ckb" hreflang="ckb" data-title="زنجیرەنووسە" data-language-autonym="کوردی" data-language-local-name="Central Kurdish" class="interlanguage-link-target"><span>کوردی</span></a></li><li class="interlanguage-link interwiki-sr mw-list-item"><a href="https://sr.wikipedia.org/wiki/%D0%9D%D0%B8%D1%81%D0%BA%D0%B0" title="Ниска – Serbian" lang="sr" hreflang="sr" data-title="Ниска" data-language-autonym="Српски / srpski" data-language-local-name="Serbian" class="interlanguage-link-target"><span>Српски / srpski</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Merkkijono" title="Merkkijono – Finnish" lang="fi" hreflang="fi" data-title="Merkkijono" data-language-autonym="Suomi" data-language-local-name="Finnish" class="interlanguage-link-target"><span>Suomi</span></a></li><li class="interlanguage-link interwiki-sv mw-list-item"><a href="https://sv.wikipedia.org/wiki/Str%C3%A4ng_(data)" title="Sträng (data) – Swedish" lang="sv" hreflang="sv" data-title="Sträng (data)" data-language-autonym="Svenska" data-language-local-name="Swedish" class="interlanguage-link-target"><span>Svenska</span></a></li><li class="interlanguage-link interwiki-tl mw-list-item"><a href="https://tl.wikipedia.org/wiki/String_(agham_pangkompyuter)" title="String (agham pangkompyuter) – Tagalog" lang="tl" hreflang="tl" data-title="String (agham pangkompyuter)" data-language-autonym="Tagalog" data-language-local-name="Tagalog" class="interlanguage-link-target"><span>Tagalog</span></a></li><li class="interlanguage-link interwiki-th mw-list-item"><a href="https://th.wikipedia.org/wiki/%E0%B8%AA%E0%B8%B2%E0%B8%A2%E0%B8%AD%E0%B8%B1%E0%B8%81%E0%B8%82%E0%B8%A3%E0%B8%B0" title="สายอักขระ – Thai" lang="th" hreflang="th" data-title="สายอักขระ" data-language-autonym="ไทย" data-language-local-name="Thai" class="interlanguage-link-target"><span>ไทย</span></a></li><li class="interlanguage-link interwiki-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/Dize_(bilgisayar_bilimi)" title="Dize (bilgisayar bilimi) – Turkish" lang="tr" hreflang="tr" data-title="Dize (bilgisayar bilimi)" data-language-autonym="Türkçe" data-language-local-name="Turkish" class="interlanguage-link-target"><span>Türkçe</span></a></li><li class="interlanguage-link interwiki-uk mw-list-item"><a href="https://uk.wikipedia.org/wiki/%D0%A0%D1%8F%D0%B4%D0%BE%D0%BA_(%D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D1%83%D0%B2%D0%B0%D0%BD%D0%BD%D1%8F)" title="Рядок (програмування) – Ukrainian" lang="uk" hreflang="uk" data-title="Рядок (програмування)" data-language-autonym="Українська" data-language-local-name="Ukrainian" class="interlanguage-link-target"><span>Українська</span></a></li><li class="interlanguage-link interwiki-wuu mw-list-item"><a href="https://wuu.wikipedia.org/wiki/%E5%AD%97%E7%AC%A6%E4%B8%B2" title="字符串 – Wu" lang="wuu" hreflang="wuu" data-title="字符串" data-language-autonym="吴语" data-language-local-name="Wu" class="interlanguage-link-target"><span>吴语</span></a></li><li class="interlanguage-link interwiki-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E5%AD%97%E4%B8%B2" title="字串 – Cantonese" lang="yue" hreflang="yue" data-title="字串" data-language-autonym="粵語" data-language-local-name="Cantonese" class="interlanguage-link-target"><span>粵語</span></a></li><li class="interlanguage-link interwiki-zh mw-list-item"><a href="https://zh.wikipedia.org/wiki/%E5%AD%97%E7%AC%A6%E4%B8%B2" title="字符串 – Chinese" lang="zh" hreflang="zh" data-title="字符串" data-language-autonym="中文" data-language-local-name="Chinese" class="interlanguage-link-target"><span>中文</span></a></li> </ul> <div class="after-portlet after-portlet-lang"><span class="wb-langlinks-edit wb-langlinks-link"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q184754#sitelinks-wikipedia" title="Edit interlanguage links" class="wbc-editpage">Edit links</a></span></div> </div> </div> </div> </header> <div class="vector-page-toolbar"> <div class="vector-page-toolbar-container"> <div id="left-navigation"> <nav aria-label="Namespaces"> <div id="p-associated-pages" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-associated-pages" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-nstab-main" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/String_(computer_science)" title="View the content page [c]" accesskey="c"><span>Article</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Talk:String_(computer_science)" rel="discussion" title="Discuss improvements to the content page [t]" accesskey="t"><span>Talk</span></a></li> </ul> </div> </div> <div id="vector-variants-dropdown" class="vector-dropdown emptyPortlet" > <input type="checkbox" id="vector-variants-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-variants-dropdown" class="vector-dropdown-checkbox " aria-label="Change language variant" > <label id="vector-variants-dropdown-label" for="vector-variants-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">English</span> </label> <div class="vector-dropdown-content"> <div id="p-variants" class="vector-menu mw-portlet mw-portlet-variants emptyPortlet" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> </ul> </div> </div> </div> </div> </nav> </div> <div id="right-navigation" class="vector-collapsible"> <nav aria-label="Views"> <div id="p-views" class="vector-menu vector-menu-tabs mw-portlet mw-portlet-views" > <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-view" class="selected vector-tab-noicon mw-list-item"><a href="/wiki/String_(computer_science)"><span>Read</span></a></li><li id="ca-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=String_(computer_science)&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=String_(computer_science)&action=history" title="Past revisions of this page [h]" accesskey="h"><span>View history</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-dropdown" class="vector-dropdown vector-page-tools-dropdown" > <input type="checkbox" id="vector-page-tools-dropdown-checkbox" role="button" aria-haspopup="true" data-event-name="ui.dropdown-vector-page-tools-dropdown" class="vector-dropdown-checkbox " aria-label="Tools" > <label id="vector-page-tools-dropdown-label" for="vector-page-tools-dropdown-checkbox" class="vector-dropdown-label cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet" aria-hidden="true" ><span class="vector-dropdown-label-text">Tools</span> </label> <div class="vector-dropdown-content"> <div id="vector-page-tools-unpinned-container" class="vector-unpinned-container"> <div id="vector-page-tools" class="vector-page-tools vector-pinnable-element"> <div class="vector-pinnable-header vector-page-tools-pinnable-header vector-pinnable-header-unpinned" data-feature-name="page-tools-pinned" data-pinnable-element-id="vector-page-tools" data-pinned-container-id="vector-page-tools-pinned-container" data-unpinned-container-id="vector-page-tools-unpinned-container" > <div class="vector-pinnable-header-label">Tools</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">hide</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="More options" > <div class="vector-menu-heading"> Actions </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="ca-more-view" class="selected vector-more-collapsible-item mw-list-item"><a href="/wiki/String_(computer_science)"><span>Read</span></a></li><li id="ca-more-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=String_(computer_science)&action=edit" title="Edit this page [e]" accesskey="e"><span>Edit</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=String_(computer_science)&action=history"><span>View history</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> General </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Special:WhatLinksHere/String_(computer_science)" title="List of all English Wikipedia pages containing links to this page [j]" accesskey="j"><span>What links here</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Special:RecentChangesLinked/String_(computer_science)" rel="nofollow" title="Recent changes in pages linked from this page [k]" accesskey="k"><span>Related changes</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:File_Upload_Wizard" title="Upload files [u]" accesskey="u"><span>Upload file</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Special:SpecialPages" title="A list of all special pages [q]" accesskey="q"><span>Special pages</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=String_(computer_science)&oldid=1260782846" title="Permanent link to this revision of this page"><span>Permanent link</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=String_(computer_science)&action=info" title="More information about this page"><span>Page information</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Special:CiteThisPage&page=String_%28computer_science%29&id=1260782846&wpFormIdentifier=titleform" title="Information on how to cite this page"><span>Cite this page</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Special:UrlShortener&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FString_%28computer_science%29"><span>Get shortened URL</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Special:QrCode&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FString_%28computer_science%29"><span>Download QR code</span></a></li> </ul> </div> </div> <div id="p-coll-print_export" class="vector-menu mw-portlet mw-portlet-coll-print_export" > <div class="vector-menu-heading"> Print/export </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Special:DownloadAsPdf&page=String_%28computer_science%29&action=show-download-screen" title="Download this page as a PDF file"><span>Download as PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=String_(computer_science)&printable=yes" title="Printable version of this page [p]" accesskey="p"><span>Printable version</span></a></li> </ul> </div> </div> <div id="p-wikibase-otherprojects" class="vector-menu mw-portlet mw-portlet-wikibase-otherprojects" > <div class="vector-menu-heading"> In other projects </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li class="wb-otherproject-link wb-otherproject-commons mw-list-item"><a href="https://commons.wikimedia.org/wiki/Category:String_(computer_science)" hreflang="en"><span>Wikimedia Commons</span></a></li><li class="wb-otherproject-link wb-otherproject-wikifunctions mw-list-item"><a href="https://www.wikifunctions.org/wiki/Z6" hreflang="en"><span>Wikifunctions</span></a></li><li id="t-wikibase" class="wb-otherproject-link wb-otherproject-wikibase-dataitem mw-list-item"><a href="https://www.wikidata.org/wiki/Special:EntityPage/Q184754" title="Structured data on this page hosted by Wikidata [g]" accesskey="g"><span>Wikidata item</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> </div> </div> </div> <div class="vector-column-end"> <div class="vector-sticky-pinned-container"> <nav class="vector-page-tools-landmark" aria-label="Page tools"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Appearance"> <div id="vector-appearance-pinned-container" class="vector-pinned-container"> <div id="vector-appearance" class="vector-appearance vector-pinnable-element"> <div class="vector-pinnable-header vector-appearance-pinnable-header vector-pinnable-header-pinned" data-feature-name="appearance-pinned" data-pinnable-element-id="vector-appearance" data-pinned-container-id="vector-appearance-pinned-container" data-unpinned-container-id="vector-appearance-unpinned-container" > <div class="vector-pinnable-header-label">Appearance</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">move to sidebar</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">hide</button> </div> </div> </div> </nav> </div> </div> <div id="bodyContent" class="vector-body" aria-labelledby="firstHeading" data-mw-ve-target-container> <div class="vector-body-before-content"> <div class="mw-indicators"> </div> <div id="siteSub" class="noprint">From Wikipedia, the free encyclopedia</div> </div> <div id="contentSub"><div id="mw-content-subtitle"><span class="mw-redirectedfrom">(Redirected from <a href="/w/index.php?title=String_(computing)&redirect=no" class="mw-redirect" title="String (computing)">String (computing)</a>)</span></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><div class="shortdescription nomobile noexcerpt noprint searchaux" style="display:none">Sequence of characters, data type</div> <figure class="mw-default-size" typeof="mw:File/Thumb"><a href="/wiki/File:String_example.png" class="mw-file-description"><img alt="Diagram of String data in computing. Shows the word "example" with each letter in a separate box. The word "String" is above, referring to the entire sentence. The label "Character" is below and points to an individual box." src="//upload.wikimedia.org/wikipedia/commons/thumb/6/6b/String_example.png/220px-String_example.png" decoding="async" width="220" height="117" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/6/6b/String_example.png/330px-String_example.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/6/6b/String_example.png/440px-String_example.png 2x" data-file-width="750" data-file-height="400" /></a><figcaption>Strings are typically made up of <a href="/wiki/Character_(computing)" title="Character (computing)">characters</a>, and are often used to store human-readable data, such as words or sentences.</figcaption></figure> <p>In <a href="/wiki/Computer_programming" title="Computer programming">computer programming</a>, a <b>string</b> is traditionally a <a href="/wiki/Sequence" title="Sequence">sequence</a> of <a href="/wiki/Character_(computing)" title="Character (computing)">characters</a>, either as a <a href="/wiki/Literal_(computer_programming)" title="Literal (computer programming)">literal constant</a> or as some kind of <a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">variable</a>. The latter may allow its elements to be <a href="/wiki/Immutable_object" title="Immutable object">mutated</a> and the length changed, or it may be fixed (after creation). A string is generally considered as a <a href="/wiki/Data_type" title="Data type">data type</a> and is often implemented as an <a href="/wiki/Array_data_structure" class="mw-redirect" title="Array data structure">array data structure</a> of <a href="/wiki/Byte" title="Byte">bytes</a> (or <a href="/wiki/Word_(computer_architecture)" title="Word (computer architecture)">words</a>) that stores a sequence of elements, typically characters, using some <a href="/wiki/Character_encoding" title="Character encoding">character encoding</a>. <i>String</i> may also denote more general <a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">arrays</a> or other sequence (or <a href="/wiki/List_(abstract_data_type)" title="List (abstract data type)">list</a>) data types and structures. </p><p>Depending on the programming language and precise data type used, a <a href="/wiki/Variable_(programming)" class="mw-redirect" title="Variable (programming)">variable</a> declared to be a string may either cause storage in memory to be statically allocated for a predetermined maximum length or employ <a href="/wiki/Dynamic_allocation" class="mw-redirect" title="Dynamic allocation">dynamic allocation</a> to allow it to hold a variable number of elements. </p><p>When a string appears literally in <a href="/wiki/Source_code" title="Source code">source code</a>, it is known as a <a href="/wiki/String_literal" title="String literal">string literal</a> or an anonymous string.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> </p><p>In <a href="/wiki/Formal_language" title="Formal language">formal languages</a>, which are used in <a href="/wiki/Mathematical_logic" title="Mathematical logic">mathematical logic</a> and <a href="/wiki/Theoretical_computer_science" title="Theoretical computer science">theoretical computer science</a>, a string is a finite sequence of <a href="/wiki/Symbol_(formal)" title="Symbol (formal)">symbols</a> that are chosen from a <a href="/wiki/Set_(mathematics)" title="Set (mathematics)">set</a> called an <a href="/wiki/Alphabet_(computer_science)" class="mw-redirect" title="Alphabet (computer science)">alphabet</a>. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Purpose">Purpose</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=1" title="Edit section: Purpose"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A primary purpose of strings is to store human-readable text, like words and sentences. Strings are used to communicate information from a computer program to the user of the program.<sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> A program may also accept string input from its user. Further, strings may store data expressed as characters yet not intended for human reading. </p><p>Example strings and their purposes: </p> <ul><li>A message like "<code>file upload complete</code>" is a string that software shows to <a href="/wiki/End_user" title="End user">end users</a>. In the program's <a href="/wiki/Source_code" title="Source code">source code</a>, this message would likely appear as a <a href="/wiki/String_literal" title="String literal">string literal</a>.</li> <li>User-entered text, like "<code>I got a new job today</code>" as a status update on a <a href="/wiki/Social_media" title="Social media">social media</a> service. Instead of a string literal, the software would likely store this string in a <a href="/wiki/Database" title="Database">database</a>.</li> <li>Alphabetical data, like "<code>AGATGCCGT</code>" representing nucleic acid sequences of <a href="/wiki/DNA" title="DNA">DNA</a>.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup></li> <li>Computer settings or parameters, like "<code>?action=edit</code>" as a URL <a href="/wiki/Query_string" title="Query string">query string</a>. Often these are intended to be somewhat human-readable, though their primary purpose is to communicate to computers.</li></ul> <p>The term string may also designate a sequence of data or computer records other than characters — like a "string of <a href="/wiki/Bit" title="Bit">bits</a>" — but when used without qualification it refers to strings of characters.<sup id="cite_ref-Burchfield1986_4-0" class="reference"><a href="#cite_note-Burchfield1986-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="History">History</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=2" title="Edit section: History"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Use of the word "string" to mean any items arranged in a line, series or succession dates back centuries.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> In 19th-Century typesetting, <a href="/wiki/Compositor_(typesetting)" class="mw-redirect" title="Compositor (typesetting)">compositors</a> used the term "string" to denote a length of type printed on paper; the string would be measured to determine the compositor's pay.<sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-Burchfield1986_4-1" class="reference"><a href="#cite_note-Burchfield1986-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup> </p><p>Use of the word "string" to mean "a sequence of symbols or linguistic elements in a definite order" emerged from mathematics, <a href="/wiki/Symbolic_logic" class="mw-redirect" title="Symbolic logic">symbolic logic</a>, and <a href="/wiki/Linguistic_theory" class="mw-redirect" title="Linguistic theory">linguistic theory</a> to speak about the <a href="/wiki/Formal_system" title="Formal system">formal</a> behavior of symbolic systems, setting aside the symbols' meaning.<sup id="cite_ref-Burchfield1986_4-2" class="reference"><a href="#cite_note-Burchfield1986-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup> </p><p>For example, logician <a href="/wiki/C._I._Lewis" title="C. I. Lewis">C. I. Lewis</a> wrote in 1918:<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> </p> <blockquote> <p>A mathematical system is any set of strings of recognisable marks in which some of the strings are taken initially and the remainder derived from these by operations performed according to rules which are independent of any meaning assigned to the marks. That a system should consist of 'marks' instead of sounds or odours is immaterial. </p> </blockquote> <p>According to <a href="/wiki/Jean_E._Sammet" title="Jean E. Sammet">Jean E. Sammet</a>, "the first realistic string handling and pattern matching language" for computers was <a href="/wiki/COMIT" title="COMIT">COMIT</a> in the 1950s, followed by the <a href="/wiki/SNOBOL" title="SNOBOL">SNOBOL</a> language of the early 1960s.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="String_datatypes">String datatypes</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=3" title="Edit section: String datatypes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1236090951">.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}</style><div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Comparison_of_programming_languages_(string_functions)" title="Comparison of programming languages (string functions)">Comparison of programming languages (string functions)</a></div> <p>A <b>string datatype</b> is a datatype modeled on the idea of a formal string. Strings are such an important and useful datatype that they are implemented in nearly every <a href="/wiki/Programming_language" title="Programming language">programming language</a>. In some languages they are available as <a href="/wiki/Primitive_type" class="mw-redirect" title="Primitive type">primitive types</a> and in others as <a href="/wiki/Composite_type" class="mw-redirect" title="Composite type">composite types</a>. The <a href="/wiki/Syntax" title="Syntax">syntax</a> of most high-level programming languages allows for a string, usually quoted in some way, to represent an instance of a string datatype; such a meta-string is called a <i>literal</i> or <i>string literal</i>. </p> <div class="mw-heading mw-heading3"><h3 id="String_length">String length</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=4" title="Edit section: String length"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Although formal strings can have an arbitrary finite length, the length of strings in real languages is often constrained to an artificial maximum. In general, there are two types of string datatypes: <i>fixed-length strings</i>, which have a fixed maximum length to be determined at <a href="/wiki/Compile_time" title="Compile time">compile time</a> and which use the same amount of memory whether this maximum is needed or not, and <i>variable-length strings</i>, whose length is not arbitrarily fixed and which can use varying amounts of memory depending on the actual requirements at run time (see <a href="/wiki/Memory_management" title="Memory management">Memory management</a>). Most strings in modern <a href="/wiki/Programming_languages" class="mw-redirect" title="Programming languages">programming languages</a> are variable-length strings. Of course, even variable-length strings are limited in length – by the size of available <a href="/wiki/Computer_memory" title="Computer memory">computer memory</a>. The string length can be stored as a separate integer (which may put another artificial limit on the length) or implicitly through a termination character, usually a character value with all bits zero such as in C programming language. See also "<a href="#Null-terminated">Null-terminated</a>" below. </p> <div class="mw-heading mw-heading3"><h3 id="Character_encoding">Character encoding</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=5" title="Edit section: Character encoding"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>String datatypes have historically allocated one byte per character, and, although the exact character set varied by region, character encodings were similar enough that programmers could often get away with ignoring this, since characters a program treated specially (such as period and space and comma) were in the same place in all the encodings a program would encounter. These character sets were typically based on <a href="/wiki/ASCII" title="ASCII">ASCII</a> or <a href="/wiki/EBCDIC" title="EBCDIC">EBCDIC</a>. If text in one encoding was displayed on a system using a different encoding, text was often <a href="/wiki/Mojibake" title="Mojibake">mangled</a>, though often somewhat readable and some computer users learned to read the mangled text. </p><p><a href="/wiki/Logograph" class="mw-redirect" title="Logograph">Logographic</a> languages such as <a href="/wiki/Chinese_language" title="Chinese language">Chinese</a>, <a href="/wiki/Japanese_language" title="Japanese language">Japanese</a>, and <a href="/wiki/Korean_language" title="Korean language">Korean</a> (known collectively as <a href="/wiki/CJK_characters" title="CJK characters">CJK</a>) need far more than 256 characters (the limit of a one 8-bit byte per-character encoding) for reasonable representation. The normal solutions involved keeping single-byte representations for ASCII and using two-byte representations for CJK <a href="/wiki/Ideographs" class="mw-redirect" title="Ideographs">ideographs</a>. Use of these with existing code led to problems with matching and cutting of strings, the severity of which depended on how the character encoding was designed. Some encodings such as the <a href="/wiki/Extended_Unix_Code" title="Extended Unix Code">EUC</a> family guarantee that a byte value in the ASCII range will represent only that ASCII character, making the encoding safe for systems that use those characters as field separators. Other encodings such as <a href="/wiki/ISO-2022" class="mw-redirect" title="ISO-2022">ISO-2022</a> and <a href="/wiki/Shift-JIS" class="mw-redirect" title="Shift-JIS">Shift-JIS</a> do not make such guarantees, making matching on byte codes unsafe. These encodings also were not "self-synchronizing", so that locating character boundaries required backing up to the start of a string, and pasting two strings together could result in corruption of the second string. </p><p><a href="/wiki/Unicode" title="Unicode">Unicode</a> has simplified the picture somewhat. Most programming languages now have a datatype for Unicode strings. Unicode's preferred byte stream format <a href="/wiki/UTF-8" title="UTF-8">UTF-8</a> is designed not to have the problems described above for older multibyte encodings. UTF-8, UTF-16 and <a href="/wiki/UTF-32" title="UTF-32">UTF-32</a> require the programmer to know that the fixed-size code units are different from the "characters", the main difficulty currently is incorrectly designed APIs that attempt to hide this difference (UTF-32 does make <i>code points</i> fixed-sized, but these are not "characters" due to composing codes). </p> <div class="mw-heading mw-heading3"><h3 id="Implementations">Implementations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=6" title="Edit section: Implementations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><span class="anchor" id="String_Buffers"></span> Some languages, such as <a href="/wiki/C%2B%2B" title="C++">C++</a>, <a href="/wiki/Perl" title="Perl">Perl</a> and <a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a>, normally allow the contents of a string to be changed after it has been created; these are termed <i>mutable</i> strings. In other languages, such as <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a>, <a href="/wiki/JavaScript" title="JavaScript">JavaScript</a>, <a href="/wiki/Lua_(programming_language)" title="Lua (programming language)">Lua</a>, <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>, and <a href="/wiki/Go_(programming_language)" title="Go (programming language)">Go</a>, the value is fixed and a new string must be created if any alteration is to be made; these are termed <i>immutable</i> strings. Some of these languages with immutable strings also provide another type that is mutable, such as Java and <a href="/wiki/.NET_Framework" title=".NET Framework">.NET</a>'s <code><a rel="nofollow" class="external text" href="https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/StringBuilder.html">StringBuilder</a></code>, the thread-safe Java <code><a rel="nofollow" class="external text" href="https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/StringBuffer.html">StringBuffer</a></code>, and the <a href="/wiki/Cocoa_(API)" title="Cocoa (API)">Cocoa</a> <code>NSMutableString</code>. There are both advantages and disadvantages to immutability: although immutable strings may require inefficiently creating many copies, they are simpler and completely <a href="/wiki/Thread_safety" title="Thread safety">thread-safe</a>. </p><p>Strings are typically implemented as <a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">arrays</a> of bytes, characters, or code units, in order to allow fast access to individual units or substrings—including characters when they have a fixed length. A few languages such as <a href="/wiki/Haskell_(programming_language)" class="mw-redirect" title="Haskell (programming language)">Haskell</a> implement them as <a href="/wiki/Linked_list" title="Linked list">linked lists</a> instead. </p><p>A lot of high-level languages provide strings as a primitive data type, such as <a href="/wiki/JavaScript" title="JavaScript">JavaScript</a> and <a href="/wiki/PHP" title="PHP">PHP</a>, while most others provide them as a composite data type, some with special language support in writing literals, for example, <a href="/wiki/Java_(programming_language)" title="Java (programming language)">Java</a> and <a href="/wiki/C_Sharp_(programming_language)" title="C Sharp (programming language)">C#</a>. </p><p>Some languages, such as <a href="/wiki/C_(programming_language)" title="C (programming language)">C</a>, <a href="/wiki/Prolog" title="Prolog">Prolog</a> and <a href="/wiki/Erlang_(programming_language)" title="Erlang (programming language)">Erlang</a>, avoid implementing a dedicated string datatype at all, instead adopting the convention of representing strings as lists of character codes. Even in programming languages having a dedicated string type, string can usually be iterated as a sequence character codes, like lists of integers or other values. </p> <div class="mw-heading mw-heading3"><h3 id="Representations">Representations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=7" title="Edit section: Representations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Representations of strings depend heavily on the choice of character repertoire and the method of character encoding. Older string implementations were designed to work with repertoire and encoding defined by ASCII, or more recent extensions like the <a href="/wiki/ISO_8859" class="mw-redirect" title="ISO 8859">ISO 8859</a> series. Modern implementations often use the extensive repertoire defined by Unicode along with a variety of complex encodings such as UTF-8 and UTF-16. </p><p>The term <i>byte string</i> usually indicates a general-purpose string of bytes, rather than strings of only (readable) characters, strings of bits, or such. Byte strings often imply that bytes can take any value and any data can be stored as-is, meaning that there should be no value interpreted as a termination value. </p><p>Most string implementations are very similar to variable-length <a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">arrays</a> with the entries storing the <a href="/wiki/Character_code" class="mw-redirect" title="Character code">character codes</a> of corresponding characters. The principal difference is that, with certain encodings, a single logical character may take up more than one entry in the array. This happens for example with UTF-8, where single codes (<a href="/wiki/Universal_Character_Set" class="mw-redirect" title="Universal Character Set">UCS</a> code points) can take anywhere from one to four bytes, and single characters can take an arbitrary number of codes. In these cases, the logical length of the string (number of characters) differs from the physical length of the array (number of bytes in use). <a href="/wiki/UTF-32" title="UTF-32">UTF-32</a> avoids the first part of the problem. </p> <div class="mw-heading mw-heading4"><h4 id="Null-terminated">Null-terminated</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=8" title="Edit section: Null-terminated"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/Null-terminated_string" title="Null-terminated string">Null-terminated string</a></div> <p>The length of a string can be stored implicitly by using a special terminating character; often this is the <a href="/wiki/Null_character" title="Null character">null character</a> (NUL), which has all bits zero, a convention used and perpetuated by the popular <a href="/wiki/C_(programming_language)" title="C (programming language)">C programming language</a>.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup> Hence, this representation is commonly referred to as a <b>C string</b>. This representation of an <i>n</i>-character string takes <i>n</i> + 1 space (1 for the terminator), and is thus an <a href="/wiki/Implicit_data_structure" title="Implicit data structure">implicit data structure</a>. </p><p>In terminated strings, the terminating code is not an allowable character in any string. Strings with <i>length</i> field do not have this limitation and can also store arbitrary <a href="/wiki/Binary_data" title="Binary data">binary data</a>. </p><p>An example of a <i>null-terminated string</i> stored in a 10-byte <a href="/wiki/Buffer_(computer_science)" class="mw-redirect" title="Buffer (computer science)">buffer</a>, along with its <a href="/wiki/ASCII" title="ASCII">ASCII</a> (or more modern <a href="/wiki/UTF-8" title="UTF-8">UTF-8</a>) representation as 8-bit <a href="/wiki/Hexadecimal_number" class="mw-redirect" title="Hexadecimal number">hexadecimal numbers</a> is: </p> <table class="wikitable" style="margin-left: auto; margin-right:auto"> <tbody><tr> <td><code>F</code></td> <td><code>R</code></td> <td><code>A</code></td> <td><code>N</code></td> <td><code>K</code> </td> <td><small><a href="/wiki/Null_character" title="Null character">NUL</a></small> </td> <td style="background: #DDD"><code style="background: #DDD">k</code> </td> <td style="background: #DDD"><code style="background: #DDD">e</code> </td> <td style="background: #DDD"><code style="background: #DDD">f</code> </td> <td style="background: #DDD"><code style="background: #DDD">w</code> </td></tr> <tr> <td>46<sub><a href="/wiki/Hexadecimal#Using_0–9_and_A–F" title="Hexadecimal">16</a></sub></td> <td>52<sub>16</sub></td> <td>41<sub>16</sub></td> <td>4E<sub>16</sub></td> <td>4B<sub>16</sub> </td> <td>00<sub>16</sub> </td> <td style="background: #DDD">6B<sub>16</sub> </td> <td style="background: #DDD">65<sub>16</sub> </td> <td style="background: #DDD">66<sub>16</sub> </td> <td style="background: #DDD">77<sub>16</sub> </td></tr></tbody></table> <p>The length of the string in the above example, "<code>FRANK</code>", is 5 characters, but it occupies 6 bytes. Characters after the terminator do not form part of the representation; they may be either part of other data or just garbage. (Strings of this form are sometimes called <i>ASCIZ strings</i>, after the original <a href="/wiki/Assembly_language" title="Assembly language">assembly language</a> directive used to declare them.) </p> <div class="mw-heading mw-heading4"><h4 id="Byte-_and_bit-terminated">Byte- and bit-terminated</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=9" title="Edit section: Byte- and bit-terminated"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Using a special byte other than null for terminating strings has historically appeared in both hardware and software, though sometimes with a value that was also a printing character. <code>$</code> was used by many assembler systems, <code>:</code> used by <a href="/wiki/Control_Data_Corporation" title="Control Data Corporation">CDC</a> systems (this character had a value of zero), and the <a href="/wiki/ZX80" title="ZX80">ZX80</a> used <code>"</code><sup id="cite_ref-asm_12-0" class="reference"><a href="#cite_note-asm-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> since this was the string delimiter in its BASIC language. </p><p>Somewhat similar, "data processing" machines like the <a href="/wiki/IBM_1401" title="IBM 1401">IBM 1401</a> used a special <a href="/wiki/Word_mark_(computer_hardware)" title="Word mark (computer hardware)">word mark</a> bit to delimit strings at the left, where the operation would start at the right. This bit had to be clear in all other parts of the string. This meant that, while the IBM 1401 had a seven-bit word, almost no-one ever thought to use this as a feature, and override the assignment of the seventh bit to (for example) handle ASCII codes. </p><p>Early microcomputer software relied upon the fact that ASCII codes do not use the high-order bit, and set it to indicate the end of a string. It must be reset to 0 prior to output.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading4"><h4 id="Length-prefixed">Length-prefixed</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=10" title="Edit section: Length-prefixed"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The length of a string can also be stored explicitly, for example by prefixing the string with the length as a byte value. This convention is used in many <a href="/wiki/Pascal_(programming_language)" title="Pascal (programming language)">Pascal</a> dialects; as a consequence, some people call such a string a <b>Pascal string</b> or <b>P-string</b>. Storing the string length as byte limits the maximum string length to 255. To avoid such limitations, improved implementations of P-strings use 16-, 32-, or 64-bit <a href="/wiki/Word_(data_type)" class="mw-redirect" title="Word (data type)">words</a> to store the string length. When the <i>length</i> field covers the <a href="/wiki/Address_space" title="Address space">address space</a>, strings are limited only by the <a href="/wiki/Dynamic_memory_allocation" class="mw-redirect" title="Dynamic memory allocation">available memory</a>. </p><p>If the length is bounded, then it can be encoded in constant space, typically a machine word, thus leading to an <a href="/wiki/Implicit_data_structure" title="Implicit data structure">implicit data structure</a>, taking <i>n</i> + <i>k</i> space, where <i>k</i> is the number of characters in a word (8 for 8-bit ASCII on a 64-bit machine, 1 for 32-bit UTF-32/UCS-4 on a 32-bit machine, etc.). If the length is not bounded, encoding a length <i>n</i> takes log(<i>n</i>) space (see <a href="/wiki/Fixed-length_code" class="mw-redirect" title="Fixed-length code">fixed-length code</a>), so length-prefixed strings are a <a href="/wiki/Succinct_data_structure" title="Succinct data structure">succinct data structure</a>, encoding a string of length <i>n</i> in log(<i>n</i>) + <i>n</i> space. </p><p>In the latter case, the length-prefix field itself does not have fixed length, therefore the actual string data needs to be moved when the string grows such that the length field needs to be increased. </p><p>Here is a Pascal string stored in a 10-byte buffer, along with its ASCII / UTF-8 representation: </p> <table class="wikitable" style="margin-left: auto; margin-right:auto"> <tbody><tr> <td><small>length</small> </td> <td><code>F</code></td> <td><code>R</code></td> <td><code>A</code></td> <td><code>N</code></td> <td><code>K</code> </td> <td style="background: #DDD"><code style="background: #DDD">k</code> </td> <td style="background: #DDD"><code style="background: #DDD">e</code> </td> <td style="background: #DDD"><code style="background: #DDD">f</code> </td> <td style="background: #DDD"><code style="background: #DDD">w</code> </td></tr> <tr> <td>05<sub>16</sub> </td> <td>46<sub>16</sub></td> <td>52<sub>16</sub></td> <td>41<sub>16</sub></td> <td>4E<sub>16</sub></td> <td>4B<sub>16</sub> </td> <td style="background: #DDD">6B<sub>16</sub> </td> <td style="background: #DDD">65<sub>16</sub> </td> <td style="background: #DDD">66<sub>16</sub> </td> <td style="background: #DDD">77<sub>16</sub> </td></tr></tbody></table> <div class="mw-heading mw-heading4"><h4 id="Strings_as_records">Strings as records</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=11" title="Edit section: Strings as records"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Many languages, including object-oriented ones, implement strings as <a href="/wiki/Record_(computer_science)" title="Record (computer science)">records</a> with an internal structure like: </p> <div class="mw-highlight mw-highlight-lang-cpp mw-content-ltr" dir="ltr"><pre><span></span><span class="k">class</span><span class="w"> </span><span class="nc">string</span><span class="w"> </span><span class="p">{</span> <span class="w"> </span><span class="kt">size_t</span><span class="w"> </span><span class="n">length</span><span class="p">;</span> <span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="o">*</span><span class="n">text</span><span class="p">;</span> <span class="p">};</span> </pre></div> <p>However, since the implementation is usually <a href="/wiki/Information_hiding" title="Information hiding">hidden</a>, the string must be accessed and modified through member functions. <code>text</code> is a pointer to a dynamically allocated memory area, which might be expanded as needed. See also <a href="/wiki/String_(C%2B%2B)" class="mw-redirect" title="String (C++)">string (C++)</a>. </p> <div class="mw-heading mw-heading4"><h4 id="Other_representations">Other representations</h4><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=12" title="Edit section: Other representations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Both character termination and length codes limit strings: For example, C character arrays that contain null (NUL) characters cannot be handled directly by <a href="/wiki/C_string_handling" title="C string handling">C string</a> library functions: Strings using a length code are limited to the maximum value of the length code. </p><p>Both of these limitations can be overcome by clever programming. </p><p>It is possible to create data structures and functions that manipulate them that do not have the problems associated with character termination and can in principle overcome length code bounds. It is also possible to optimize the string represented using techniques from <a href="/wiki/Run-length_encoding" title="Run-length encoding">run length encoding</a> (replacing repeated characters by the character value and a length) and <a href="/wiki/Hamming_coding" class="mw-redirect" title="Hamming coding">Hamming encoding</a><sup class="noprint Inline-Template" style="margin-left:0.1em; white-space:nowrap;">[<i><a href="/wiki/Wikipedia:Please_clarify" title="Wikipedia:Please clarify"><span title="did you mean Huffman compression? Or do we need a few more words about error correction coding here? I don't see how either one helps us find out how long the string is. (June 2015)">clarification needed</span></a></i>]</sup>. </p><p>While these representations are common, others are possible. Using <a href="/wiki/Rope_(data_structure)" title="Rope (data structure)">ropes</a> makes certain string operations, such as insertions, deletions, and concatenations more efficient. </p><p>The core data structure in a <a href="/wiki/Text_editor" title="Text editor">text editor</a> is the one that manages the string (sequence of characters) that represents the current state of the file being edited. While that state could be stored in a single long consecutive array of characters, a typical text editor instead uses an alternative representation as its sequence data structure—a <a href="/wiki/Gap_buffer" title="Gap buffer">gap buffer</a>, a <a href="/wiki/Linked_list" title="Linked list">linked list</a> of lines, a <a href="/wiki/Piece_table" title="Piece table">piece table</a>, or a <a href="/wiki/Rope_(data_structure)" title="Rope (data structure)">rope</a>—which makes certain string operations, such as insertions, deletions, and undoing previous edits, more efficient.<sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading3"><h3 id="Security_concerns">Security concerns</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=13" title="Edit section: Security concerns"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The differing memory layout and storage requirements of strings can affect the security of the program accessing the string data. String representations requiring a terminating character are commonly susceptible to <a href="/wiki/Buffer_overflow" title="Buffer overflow">buffer overflow</a> problems if the terminating character is not present, caused by a coding error or an <a href="/wiki/Hacker_(computer_security)" class="mw-redirect" title="Hacker (computer security)">attacker</a> deliberately altering the data. String representations adopting a separate length field are also susceptible if the length can be manipulated. In such cases, program code accessing the string data requires <a href="/wiki/Bounds_checking" title="Bounds checking">bounds checking</a> to ensure that it does not inadvertently access or change data outside of the string memory limits. </p><p>String data is frequently obtained from user input to a program. As such, it is the responsibility of the program to validate the string to ensure that it represents the expected format. Performing <a href="/wiki/Improper_input_validation" title="Improper input validation">limited or no validation</a> of user input can cause a program to be vulnerable to <a href="/wiki/Code_injection" title="Code injection">code injection</a> attacks. </p> <div class="mw-heading mw-heading2"><h2 id="Literal_strings">Literal strings</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=14" title="Edit section: Literal strings"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">Main article: <a href="/wiki/String_literal" title="String literal">String literal</a></div> <p>Sometimes, strings need to be embedded inside a text file that is both human-readable and intended for consumption by a machine. This is needed in, for example, source code of programming languages, or in configuration files. In this case, the NUL character does not work well as a terminator since it is normally invisible (non-printable) and is difficult to input via a keyboard. Storing the string length would also be inconvenient as manual computation and tracking of the length is tedious and error-prone. </p><p>Two common representations are: </p> <ul><li>Surrounded by <a href="/wiki/Quotation_mark" title="Quotation mark">quotation marks</a> (ASCII <a href="/wiki/Hexadecimal#Using_0–9_and_A–F" title="Hexadecimal">0x22</a> double quote <code>"str"</code> or ASCII 0x27 single quote <code>'str'</code>), used by most programming languages. To be able to include special characters such as the quotation mark itself, newline characters, or non-printable characters, <a href="/wiki/Escape_character" title="Escape character">escape sequences</a> are often available, usually prefixed with the <a href="/wiki/Backslash" title="Backslash">backslash</a> character (ASCII 0x5C).</li> <li>Terminated by a <a href="/wiki/Newline" title="Newline">newline</a> sequence, for example in Windows <a href="/wiki/INI_file" title="INI file">INI files</a>.</li></ul> <div class="mw-heading mw-heading2"><h2 id="Non-text_strings">Non-text strings</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=15" title="Edit section: Non-text strings"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>While character strings are very common uses of strings, a string in computer science may refer generically to any sequence of homogeneously typed data. A <a href="/wiki/Bit_string" class="mw-redirect" title="Bit string">bit string</a> or <a href="/wiki/Byte_string" class="mw-redirect" title="Byte string">byte string</a>, for example, may be used to represent non-textual <a href="/wiki/Binary_data" title="Binary data">binary data</a> retrieved from a communications medium. This data may or may not be represented by a string-specific datatype, depending on the needs of the application, the desire of the programmer, and the capabilities of the programming language being used. If the programming language's string implementation is not <a href="/wiki/8-bit_clean" title="8-bit clean">8-bit clean</a>, data corruption may ensue. </p><p>C programmers draw a sharp distinction between a "string", aka a "string of characters", which by definition is always null terminated, vs. a "array of characters" which may be stored in the same array but is often not null terminated. Using <a href="/wiki/C_string_handling" title="C string handling">C string handling</a> functions on such an array of characters often seems to work, but later leads to <a href="#Security_concerns">security problems</a>.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-17" class="reference"><a href="#cite_note-17"><span class="cite-bracket">[</span>17<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="String_processing_algorithms">String processing algorithms</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=16" title="Edit section: String processing algorithms"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">"Stringology" redirects here. For the physical theory, see <a href="/wiki/String_theory" title="String theory">String theory</a>.</div> <p>There are many <a href="/wiki/Algorithm" title="Algorithm">algorithms</a> for processing strings, each with various trade-offs. Competing algorithms can be <a href="/wiki/Analysis_of_algorithms" title="Analysis of algorithms">analyzed</a> with respect to run time, storage requirements, and so forth. The name <b>stringology</b> was coined in 1984 by computer scientist <a href="/wiki/Zvi_Galil" title="Zvi Galil">Zvi Galil</a> for the theory of algorithms and data structures used for string processing.<sup id="cite_ref-18" class="reference"><a href="#cite_note-18"><span class="cite-bracket">[</span>18<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-19" class="reference"><a href="#cite_note-19"><span class="cite-bracket">[</span>19<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-20" class="reference"><a href="#cite_note-20"><span class="cite-bracket">[</span>20<span class="cite-bracket">]</span></a></sup> </p><p>Some categories of algorithms include: </p> <ul><li><a href="/wiki/String_searching_algorithm" class="mw-redirect" title="String searching algorithm">String searching algorithms</a> for finding a given substring or pattern</li> <li><a href="/wiki/String_manipulation_algorithm" class="mw-redirect" title="String manipulation algorithm">String manipulation algorithms</a></li> <li><a href="/wiki/Sorting_algorithm" title="Sorting algorithm">Sorting algorithms</a></li> <li><a href="/wiki/Regular_expression" title="Regular expression">Regular expression</a> algorithms</li> <li><a href="/wiki/Parser" class="mw-redirect" title="Parser">Parsing</a> a string</li> <li><a href="/wiki/Sequence_mining" class="mw-redirect" title="Sequence mining">Sequence mining</a></li></ul> <p>Advanced string algorithms often employ complex mechanisms and data structures, among them <a href="/wiki/Suffix_tree" title="Suffix tree">suffix trees</a> and <a href="/wiki/Finite-state_machine" title="Finite-state machine">finite-state machines</a>. </p> <div class="mw-heading mw-heading2"><h2 id="Character_string-oriented_languages_and_utilities">Character string-oriented languages and utilities</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=17" title="Edit section: Character string-oriented languages and utilities"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Character strings are such a useful datatype that several languages have been designed in order to make string processing applications easy to write. Examples include the following languages: </p> <ul><li><a href="/wiki/AWK" title="AWK">AWK</a></li> <li><a href="/wiki/Icon_(programming_language)" title="Icon (programming language)">Icon</a></li> <li><a href="/wiki/MUMPS" title="MUMPS">MUMPS</a></li> <li><a href="/wiki/Perl" title="Perl">Perl</a></li> <li><a href="/wiki/Rexx" title="Rexx">Rexx</a></li> <li><a href="/wiki/Ruby_(programming_language)" title="Ruby (programming language)">Ruby</a></li> <li><a href="/wiki/Sed" title="Sed">sed</a></li> <li><a href="/wiki/SNOBOL" title="SNOBOL">SNOBOL</a></li> <li><a href="/wiki/Tcl" title="Tcl">Tcl</a></li> <li><a href="/wiki/TTM_(programming_language)" title="TTM (programming language)">TTM</a></li></ul> <p>Many <a href="/wiki/Unix" title="Unix">Unix</a> utilities perform simple string manipulations and can be used to easily program some powerful string processing algorithms. Files and finite streams may be viewed as strings. </p><p>Some <a href="/wiki/Application_programming_interface" class="mw-redirect" title="Application programming interface">APIs</a> like <a href="/wiki/Multimedia_Control_Interface" class="mw-redirect" title="Multimedia Control Interface">Multimedia Control Interface</a>, <a href="/wiki/Embedded_SQL" title="Embedded SQL">embedded SQL</a> or <a href="/wiki/Printf" title="Printf">printf</a> use strings to hold commands that will be interpreted. </p><p>Many <a href="/wiki/Scripting_programming_language" class="mw-redirect" title="Scripting programming language">scripting programming languages</a>, including Perl, <a href="/wiki/Python_(programming_language)" title="Python (programming language)">Python</a>, Ruby, and Tcl employ <a href="/wiki/Regular_expression" title="Regular expression">regular expressions</a> to facilitate text operations. Perl is particularly noted for its regular expression use,<sup id="cite_ref-21" class="reference"><a href="#cite_note-21"><span class="cite-bracket">[</span>21<span class="cite-bracket">]</span></a></sup> and many other languages and applications implement <a href="/wiki/Perl_Compatible_Regular_Expressions" title="Perl Compatible Regular Expressions">Perl compatible regular expressions</a>. </p><p>Some languages such as Perl and Ruby support <a href="/wiki/String_interpolation" title="String interpolation">string interpolation</a>, which permits arbitrary expressions to be evaluated and included in string literals. </p> <div class="mw-heading mw-heading2"><h2 id="Character_string_functions">Character string functions</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=18" title="Edit section: Character string functions"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Comparison_of_programming_languages_(string_functions)" title="Comparison of programming languages (string functions)">Comparison of programming languages (string functions)</a></div> <p><a href="/wiki/String_function" class="mw-redirect" title="String function">String functions</a> are used to create strings or change the contents of a mutable string. They also are used to query information about a string. The set of functions and their names varies depending on the <a href="/wiki/Programming_language" title="Programming language">computer programming language</a>. </p><p>The most basic example of a string function is the <a href="/wiki/String_length" class="mw-redirect" title="String length">string length</a> function – the function that returns the length of a string (not counting any terminator characters or any of the string's internal structural information) and does not modify the string. This function is often named <code><a href="/wiki/Comparison_of_programming_languages_(string_functions)#length" title="Comparison of programming languages (string functions)">length</a></code> or <code>len</code>. For example, <code>length("hello world")</code> would return 11. Another common function is <a href="/wiki/Concatenation" title="Concatenation">concatenation</a>, where a new string is created by appending two strings, often this is the + addition operator. </p><p>Some <a href="/wiki/Microprocessor" title="Microprocessor">microprocessor</a>'s <a href="/wiki/Instruction_set_architecture" title="Instruction set architecture">instruction set architectures</a> contain direct support for string operations, such as block copy (e.g. In <a href="/wiki/Intel_x86" class="mw-redirect" title="Intel x86">intel x86m</a> <code>REPNZ MOVSB</code>).<sup id="cite_ref-22" class="reference"><a href="#cite_note-22"><span class="cite-bracket">[</span>22<span class="cite-bracket">]</span></a></sup> </p> <div class="mw-heading mw-heading2"><h2 id="Formal_theory">Formal theory</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=19" title="Edit section: Formal theory"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236090951"><div role="note" class="hatnote navigation-not-searchable">See also: <a href="/wiki/Tuple" title="Tuple">Tuple</a></div> <p>Let Σ be a <a href="/wiki/Finite_set" title="Finite set">finite set</a> of distinct, unambiguous symbols (alternatively called characters), called the <a href="/wiki/Alphabet_(formal_languages)" title="Alphabet (formal languages)">alphabet</a>. A <b>string</b> (or <b>word</b><sup id="cite_ref-23" class="reference"><a href="#cite_note-23"><span class="cite-bracket">[</span>23<span class="cite-bracket">]</span></a></sup> or <b>expression</b><sup id="cite_ref-24" class="reference"><a href="#cite_note-24"><span class="cite-bracket">[</span>24<span class="cite-bracket">]</span></a></sup>) over Σ is any finite <a href="/wiki/Sequence" title="Sequence">sequence</a> of symbols from Σ.<sup id="cite_ref-partee_25-0" class="reference"><a href="#cite_note-partee-25"><span class="cite-bracket">[</span>25<span class="cite-bracket">]</span></a></sup> For example, if Σ = {0, 1}, then <i>01011</i> is a string over Σ. </p><p>The <i><a href="/wiki/Length" title="Length">length</a></i> of a string <i>s</i> is the number of symbols in <i>s</i> (the length of the sequence) and can be any <a href="/wiki/Non-negative_integer" class="mw-redirect" title="Non-negative integer">non-negative integer</a>; it is often denoted as |<i>s</i>|. The <i><a href="/wiki/Empty_string" title="Empty string">empty string</a></i> is the unique string over Σ of length 0, and is denoted <i>ε</i> or <i>λ</i>.<sup id="cite_ref-partee_25-1" class="reference"><a href="#cite_note-partee-25"><span class="cite-bracket">[</span>25<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-26" class="reference"><a href="#cite_note-26"><span class="cite-bracket">[</span>26<span class="cite-bracket">]</span></a></sup> </p><p>The set of all strings over Σ of length <i>n</i> is denoted Σ<sup><i>n</i></sup>. For example, if Σ = {0, 1}, then Σ<sup>2</sup> = {00, 01, 10, 11}. We have Σ<sup>0</sup> = {ε} for every alphabet Σ. </p><p>The set of all strings over Σ of any length is the <a href="/wiki/Kleene_star" title="Kleene star">Kleene closure</a> of Σ and is denoted Σ<sup>*</sup>. In terms of Σ<sup><i>n</i></sup>, </p> <dl><dd><span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Sigma ^{*}=\bigcup _{n\in \mathbb {N} \cup \{0\}}\Sigma ^{n}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <msup> <mi mathvariant="normal">Σ<!-- Σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mo>∗<!-- ∗ --></mo> </mrow> </msup> <mo>=</mo> <munder> <mo>⋃<!-- ⋃ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> <mo>∈<!-- ∈ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="double-struck">N</mi> </mrow> <mo>∪<!-- ∪ --></mo> <mo fence="false" stretchy="false">{</mo> <mn>0</mn> <mo fence="false" stretchy="false">}</mo> </mrow> </munder> <msup> <mi mathvariant="normal">Σ<!-- Σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mi>n</mi> </mrow> </msup> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle \Sigma ^{*}=\bigcup _{n\in \mathbb {N} \cup \{0\}}\Sigma ^{n}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/b6fd9dc82ae5e5350875e70b440f7723e670ebe4" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -3.505ex; width:15.946ex; height:6.009ex;" alt="{\displaystyle \Sigma ^{*}=\bigcup _{n\in \mathbb {N} \cup \{0\}}\Sigma ^{n}}"></span></dd></dl> <p>For example, if Σ = {0, 1}, then Σ<sup>*</sup> = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, ...}. Although the set Σ<sup>*</sup> itself is <a href="/wiki/Countably_infinite" class="mw-redirect" title="Countably infinite">countably infinite</a>, each element of Σ<sup>*</sup> is a string of finite length. </p><p>A set of strings over Σ (i.e. any <a href="/wiki/Subset" title="Subset">subset</a> of Σ<sup>*</sup>) is called a <i><a href="/wiki/Formal_language" title="Formal language">formal language</a></i> over Σ. For example, if Σ = {0, 1}, the set of strings with an even number of zeros, {ε, 1, 00, 11, 001, 010, 100, 111, 0000, 0011, 0101, 0110, 1001, 1010, 1100, 1111, ...}, is a formal language over Σ. </p> <div class="mw-heading mw-heading3"><h3 id="Concatenation_and_substrings">Concatenation and substrings</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=20" title="Edit section: Concatenation and substrings"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p><i><a href="/wiki/Concatenation" title="Concatenation">Concatenation</a></i> is an important <a href="/wiki/Binary_operation" title="Binary operation">binary operation</a> on Σ<sup>*</sup>. For any two strings <i>s</i> and <i>t</i> in Σ<sup>*</sup>, their concatenation is defined as the sequence of symbols in <i>s</i> followed by the sequence of characters in <i>t</i>, and is denoted <i>st</i>. For example, if Σ = {a, b, ..., z}, <i>s</i> = <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">bear</code>, and <i>t</i> = <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">hug</code>, then <i>st</i> = <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">bearhug</code> and <i>ts</i> = <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">hugbear</code>. </p><p>String concatenation is an <a href="/wiki/Associative" class="mw-redirect" title="Associative">associative</a>, but non-<a href="/wiki/Commutative" class="mw-redirect" title="Commutative">commutative</a> operation. The empty string ε serves as the <a href="/wiki/Identity_element" title="Identity element">identity element</a>; for any string <i>s</i>, ε<i>s</i> = <i>s</i>ε = <i>s</i>. Therefore, the set Σ<sup>*</sup> and the concatenation operation form a <a href="/wiki/Monoid" title="Monoid">monoid</a>, the <a href="/wiki/Free_monoid" title="Free monoid">free monoid</a> generated by Σ. In addition, the length function defines a <a href="/wiki/Monoid_homomorphism" class="mw-redirect" title="Monoid homomorphism">monoid homomorphism</a> from Σ<sup>*</sup> to the non-negative integers (that is, a function <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle L:\Sigma ^{*}\mapsto \mathbb {N} \cup \{0\}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>L</mi> <mo>:</mo> <msup> <mi mathvariant="normal">Σ<!-- Σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mo>∗<!-- ∗ --></mo> </mrow> </msup> <mo stretchy="false">↦<!-- ↦ --></mo> <mrow class="MJX-TeXAtom-ORD"> <mi mathvariant="double-struck">N</mi> </mrow> <mo>∪<!-- ∪ --></mo> <mo fence="false" stretchy="false">{</mo> <mn>0</mn> <mo fence="false" stretchy="false">}</mo> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle L:\Sigma ^{*}\mapsto \mathbb {N} \cup \{0\}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/54ead89fbb809ed7a42131073164dcf1a5304eea" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:17.614ex; height:2.843ex;" alt="{\displaystyle L:\Sigma ^{*}\mapsto \mathbb {N} \cup \{0\}}"></span>, such that <span class="mwe-math-element"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle L(st)=L(s)+L(t)\quad \forall s,t\in \Sigma ^{*}}"> <semantics> <mrow class="MJX-TeXAtom-ORD"> <mstyle displaystyle="true" scriptlevel="0"> <mi>L</mi> <mo stretchy="false">(</mo> <mi>s</mi> <mi>t</mi> <mo stretchy="false">)</mo> <mo>=</mo> <mi>L</mi> <mo stretchy="false">(</mo> <mi>s</mi> <mo stretchy="false">)</mo> <mo>+</mo> <mi>L</mi> <mo stretchy="false">(</mo> <mi>t</mi> <mo stretchy="false">)</mo> <mspace width="1em" /> <mi mathvariant="normal">∀<!-- ∀ --></mi> <mi>s</mi> <mo>,</mo> <mi>t</mi> <mo>∈<!-- ∈ --></mo> <msup> <mi mathvariant="normal">Σ<!-- Σ --></mi> <mrow class="MJX-TeXAtom-ORD"> <mo>∗<!-- ∗ --></mo> </mrow> </msup> </mstyle> </mrow> <annotation encoding="application/x-tex">{\displaystyle L(st)=L(s)+L(t)\quad \forall s,t\in \Sigma ^{*}}</annotation> </semantics> </math></span><img src="https://wikimedia.org/api/rest_v1/media/math/render/svg/804e963902ffd26937a60e63e44361e6041d5f08" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:32.128ex; height:2.843ex;" alt="{\displaystyle L(st)=L(s)+L(t)\quad \forall s,t\in \Sigma ^{*}}"></span>). </p><p>A string <i>s</i> is said to be a <i><a href="/wiki/Substring" title="Substring">substring</a></i> or <i>factor</i> of <i>t</i> if there exist (possibly empty) strings <i>u</i> and <i>v</i> such that <i>t</i> = <i>usv</i>. The <a href="/wiki/Binary_relation" title="Binary relation">relation</a> "is a substring of" defines a <a href="/wiki/Partial_order" class="mw-redirect" title="Partial order">partial order</a> on Σ<sup>*</sup>, the <a href="/wiki/Least_element" class="mw-redirect" title="Least element">least element</a> of which is the empty string. </p> <div class="mw-heading mw-heading3"><h3 id="Prefixes_and_suffixes">Prefixes and suffixes</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=21" title="Edit section: Prefixes and suffixes"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A string <i>s</i> is said to be a <a href="/wiki/Substring#Prefix" title="Substring">prefix</a> of <i>t</i> if there exists a string <i>u</i> such that <i>t</i> = <i>su</i>. If <i>u</i> is nonempty, <i>s</i> is said to be a <i>proper</i> prefix of <i>t</i>. Symmetrically, a string <i>s</i> is said to be a <a href="/wiki/Substring#Suffix" title="Substring">suffix</a> of <i>t</i> if there exists a string <i>u</i> such that <i>t</i> = <i>us</i>. If <i>u</i> is nonempty, <i>s</i> is said to be a <i>proper</i> suffix of <i>t</i>. Suffixes and prefixes are substrings of <i>t</i>. Both the relations "is a prefix of" and "is a suffix of" are <a href="/wiki/Prefix_order" title="Prefix order">prefix orders</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Reversal">Reversal</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=22" title="Edit section: Reversal"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>The reverse of a string is a string with the same symbols but in reverse order. For example, if <i>s</i> = abc (where a, b, and c are symbols of the alphabet), then the reverse of <i>s</i> is cba. A string that is the reverse of itself (e.g., <i>s</i> = madam) is called a <a href="/wiki/Palindrome#Computation_theory" title="Palindrome">palindrome</a>, which also includes the empty string and all strings of length 1. </p> <div class="mw-heading mw-heading3"><h3 id="Rotations">Rotations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=23" title="Edit section: Rotations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A string <i>s</i> = <i>uv</i> is said to be a rotation of <i>t</i> if <i>t</i> = <i>vu</i>. For example, if Σ = {0, 1} the string 0011001 is a rotation of 0100110, where <i>u</i> = 00110 and <i>v</i> = 01. As another example, the string abc has three different rotations, viz. abc itself (with <i>u</i>=abc, <i>v</i>=ε), bca (with <i>u</i>=bc, <i>v</i>=a), and cab (with <i>u</i>=c, <i>v</i>=ab). </p> <div class="mw-heading mw-heading3"><h3 id="Lexicographical_ordering">Lexicographical ordering</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=24" title="Edit section: Lexicographical ordering"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>It is often useful to define an <a href="/wiki/Order_theory" title="Order theory">ordering</a> on a set of strings. If the alphabet Σ has a <a href="/wiki/Total_order" title="Total order">total order</a> (cf. <a href="/wiki/Alphabetical_order" title="Alphabetical order">alphabetical order</a>) one can define a total order on Σ<sup>*</sup> called <a href="/wiki/Lexicographical_order" class="mw-redirect" title="Lexicographical order">lexicographical order</a>. The lexicographical order is <a href="/wiki/Total_order" title="Total order">total</a> if the alphabetical order is, but is not <a href="/wiki/Well-founded" class="mw-redirect" title="Well-founded">well-founded</a> for any nontrivial alphabet, even if the alphabetical order is. For example, if Σ = {0, 1} and 0 < 1, then the lexicographical order on Σ<sup>*</sup> includes the relationships ε < 0 < 00 < 000 < ... < 0001 < ... < 001 < ... < 01 < 010 < ... < 011 < 0110 < ... < 01111 < ... < 1 < 10 < 100 < ... < 101 < ... < 111 < ... < 1111 < ... < 11111 ... With respect to this ordering, e.g. the infinite set { 1, 01, 001, 0001, 00001, 000001, ... } has no minimal element. </p><p>See <a href="/wiki/Shortlex" class="mw-redirect" title="Shortlex">Shortlex</a> for an alternative string ordering that preserves well-foundedness. For the example alphabet, the shortlex order is ε < 0 < 1 < 00 < 01 < 10 < 11 < 000 < 001 < 010 < 011 < 100 < 101 < 0110 < 111 < 0000 < 0001 < 0010 < 0011 < ... < 1111 < 00000 < 00001 ... </p> <div class="mw-heading mw-heading3"><h3 id="String_operations">String operations</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=25" title="Edit section: String operations"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>A number of additional operations on strings commonly occur in the formal theory. These are given in the article on <a href="/wiki/String_operations" title="String operations">string operations</a>. </p> <div class="mw-heading mw-heading3"><h3 id="Topology">Topology</h3><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=26" title="Edit section: Topology"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <figure typeof="mw:File/Thumb"><a href="/wiki/File:Hamming_distance_3_bit_binary.svg" class="mw-file-description"><img src="//upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Hamming_distance_3_bit_binary.svg/150px-Hamming_distance_3_bit_binary.svg.png" decoding="async" width="150" height="118" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Hamming_distance_3_bit_binary.svg/225px-Hamming_distance_3_bit_binary.svg.png 1.5x, //upload.wikimedia.org/wikipedia/commons/thumb/b/b4/Hamming_distance_3_bit_binary.svg/300px-Hamming_distance_3_bit_binary.svg.png 2x" data-file-width="190" data-file-height="150" /></a><figcaption>(Hyper)cube of binary strings of length 3</figcaption></figure> <p>Strings admit the following interpretation as nodes on a graph, where <i>k</i> is the number of symbols in Σ: </p> <ul><li>Fixed-length strings of length <i>n</i> can be viewed as the integer locations in an <i>n</i>-dimensional <a href="/wiki/Hypercube" title="Hypercube">hypercube</a> with sides of length <i>k</i>-1.</li> <li>Variable-length strings (of finite length) can be viewed as nodes on a <a href="/wiki/K-ary_tree" class="mw-redirect" title="K-ary tree">perfect <i>k</i>-ary tree</a>.</li> <li><a href="/wiki/Infinite_string" class="mw-redirect" title="Infinite string">Infinite strings</a> (otherwise not considered here) can be viewed as infinite paths on a <i>k</i>-node <a href="/wiki/Complete_graph" title="Complete graph">complete graph</a>.</li></ul> <p>The natural topology on the set of fixed-length strings or variable-length strings is the discrete topology, but the natural topology on the set of infinite strings is the <a href="/wiki/Limit_topology" class="mw-redirect" title="Limit topology">limit topology</a>, viewing the set of infinite strings as the <a href="/wiki/Inverse_limit" title="Inverse limit">inverse limit</a> of the sets of finite strings. This is the construction used for the <a href="/wiki/P-adic" class="mw-redirect" title="P-adic"><i>p</i>-adic numbers</a> and some constructions of the <a href="/wiki/Cantor_set" title="Cantor set">Cantor set</a>, and yields the same topology. </p><p><a href="/wiki/Isomorphism" title="Isomorphism">Isomorphisms</a> between string representations of topologies can be found by normalizing according to the <a href="/wiki/Lexicographically_minimal_string_rotation" title="Lexicographically minimal string rotation">lexicographically minimal string rotation</a>. </p> <div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=27" title="Edit section: See also"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/Binary-safe" title="Binary-safe">Binary-safe</a> — a property of string manipulating functions treating their input as raw data stream</li> <li><a href="/wiki/Bit_array" title="Bit array">Bit array</a> — a string of binary digits</li> <li><a href="/wiki/C_string_handling" title="C string handling">C string handling</a> — overview of C string handling</li> <li><a href="/wiki/C%2B%2B_string_handling" title="C++ string handling">C++ string handling</a> — overview of C++ string handling</li> <li><a href="/wiki/Comparison_of_programming_languages_(string_functions)" title="Comparison of programming languages (string functions)">Comparison of programming languages (string functions)</a></li> <li><a href="/wiki/Connection_string" title="Connection string">Connection string</a> — passed to a driver to initiate a connection (e.g., to a database)</li> <li><a href="/wiki/Empty_string" title="Empty string">Empty string</a> — its properties and representation in programming languages</li> <li><a href="/wiki/Incompressible_string" title="Incompressible string">Incompressible string</a> — a string that cannot be compressed by any algorithm</li> <li><a href="/wiki/Rope_(data_structure)" title="Rope (data structure)">Rope (data structure)</a> — a data structure for efficiently manipulating long strings</li> <li><a href="/wiki/String_metric" title="String metric">String metric</a> — notions of similarity between strings</li></ul> <div class="mw-heading mw-heading2"><h2 id="References">References</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=String_(computer_science)&action=edit&section=28" title="Edit section: References"><span>edit</span></a><span class="mw-editsection-bracket">]</span></span></div> <style data-mw-deduplicate="TemplateStyles:r1239543626">.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}</style><div class="reflist"> <div class="mw-references-wrap mw-references-columns"><ol class="references"> <li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.acsu.buffalo.edu/~fineberg/mfc158/week10lecture.htm">"Introduction To Java – MFC 158 G"</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160303233357/http://www.acsu.buffalo.edu/~fineberg/mfc158/week10lecture.htm">Archived</a> from the original on 2016-03-03. <q>String literals (or constants) are called 'anonymous strings'<span class="cs1-kern-right"></span></q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Introduction+To+Java+%E2%80%93+MFC+158+G&rft_id=http%3A%2F%2Fwww.acsu.buffalo.edu%2F~fineberg%2Fmfc158%2Fweek10lecture.htm&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFde_St._Germain" class="citation web cs1">de St. Germain, H. James. <a rel="nofollow" class="external text" href="https://users.cs.utah.edu/~germain/PPS/Topics/strings.html">"Strings"</a>. <i>University of Utah, Kahlert School of Computing</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=University+of+Utah%2C+Kahlert+School+of+Computing&rft.atitle=Strings&rft.aulast=de+St.+Germain&rft.aufirst=H.+James&rft_id=https%3A%2F%2Fusers.cs.utah.edu%2F~germain%2FPPS%2FTopics%2Fstrings.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFFrancisMerk2019" class="citation web cs1">Francis, David M.; Merk, Heather L. (November 14, 2019). <a rel="nofollow" class="external text" href="https://plant-breeding-genomics.extension.org/dna-as-a-biochemical-entity-and-data-string/">"DNA as a Biochemical Entity and Data String"</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=DNA+as+a+Biochemical+Entity+and+Data+String&rft.date=2019-11-14&rft.aulast=Francis&rft.aufirst=David+M.&rft.au=Merk%2C+Heather+L.&rft_id=https%3A%2F%2Fplant-breeding-genomics.extension.org%2Fdna-as-a-biochemical-entity-and-data-string%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-Burchfield1986-4"><span class="mw-cite-backlink">^ <a href="#cite_ref-Burchfield1986_4-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-Burchfield1986_4-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-Burchfield1986_4-2"><sup><i><b>c</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBurchfield1986" class="citation encyclopaedia cs1"><a href="/wiki/Robert_Burchfield" title="Robert Burchfield">Burchfield, R.W.</a> (1986). "string". <i>A Supplement to the Oxford English Dictionary</i>. Oxford at the Clarendon Press.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=string&rft.btitle=A+Supplement+to+the+Oxford+English+Dictionary&rft.pub=Oxford+at+the+Clarendon+Press&rft.date=1986&rft.aulast=Burchfield&rft.aufirst=R.W.&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation encyclopaedia cs1">"string". <i>The Oxford English Dictionary</i>. Vol. X. Oxford at the Clarendon Press. 1933.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=string&rft.btitle=The+Oxford+English+Dictionary&rft.pub=Oxford+at+the+Clarendon+Press&rft.date=1933&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://www.etymonline.com/search?q=string">"string (n.)"</a>. <i>Online Etymology Dictionary</i>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Online+Etymology+Dictionary&rft.atitle=string+%28n.%29&rft_id=https%3A%2F%2Fwww.etymonline.com%2Fsearch%3Fq%3Dstring&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFWhitneySmith" class="citation encyclopaedia cs1"><a href="/wiki/William_Dwight_Whitney" title="William Dwight Whitney">Whitney, William Dwight</a>; <a href="/wiki/Benjamin_Eli_Smith" title="Benjamin Eli Smith">Smith, Benjamin E.</a> "string". <i>The Century Dictionary</i>. New York: The Century Company. p. 5994.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=bookitem&rft.atitle=string&rft.btitle=The+Century+Dictionary&rft.place=New+York&rft.pages=5994&rft.pub=The+Century+Company&rft.aulast=Whitney&rft.aufirst=William+Dwight&rft.au=Smith%2C+Benjamin+E.&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation news cs1">"Old Union's Demise". <i><a href="/wiki/Milwaukee_Journal_Sentinel" title="Milwaukee Journal Sentinel">Milwaukee Sentinel</a></i>. January 11, 1898. p. 3.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Milwaukee+Sentinel&rft.atitle=Old+Union%27s+Demise&rft.pages=3&rft.date=1898-01-11&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFLewis1918" class="citation book cs1"><a href="/wiki/C.I._Lewis" class="mw-redirect" title="C.I. Lewis">Lewis, C.I.</a> (1918). <a rel="nofollow" class="external text" href="https://archive.org/details/asurveyofsymboli00lewiuoft/page/355/mode/1up"><i>A survey of symbolic logic</i></a>. Berkeley: University of California Press. p. 355.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=A+survey+of+symbolic+logic&rft.place=Berkeley&rft.pages=355&rft.pub=University+of+California+Press&rft.date=1918&rft.aulast=Lewis&rft.aufirst=C.I.&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fasurveyofsymboli00lewiuoft%2Fpage%2F355%2Fmode%2F1up&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFSammet1972" class="citation journal cs1">Sammet, Jean E. (July 1972). <a rel="nofollow" class="external text" href="https://redirect.cs.umbc.edu/courses/undergraduate/331/resources/papers/sammet1972.pdf">"Programming Languages: History and Future"</a> <span class="cs1-format">(PDF)</span>. <i>Communications of the ACM</i>. <b>15</b> (7). <a href="/wiki/Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1145%2F361454.361485">10.1145/361454.361485</a>. <a href="/wiki/S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a> <a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:2003242">2003242</a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=article&rft.jtitle=Communications+of+the+ACM&rft.atitle=Programming+Languages%3A+History+and+Future&rft.volume=15&rft.issue=7&rft.date=1972-07&rft_id=info%3Adoi%2F10.1145%2F361454.361485&rft_id=https%3A%2F%2Fapi.semanticscholar.org%2FCorpusID%3A2003242%23id-name%3DS2CID&rft.aulast=Sammet&rft.aufirst=Jean+E.&rft_id=https%3A%2F%2Fredirect.cs.umbc.edu%2Fcourses%2Fundergraduate%2F331%2Fresources%2Fpapers%2Fsammet1972.pdf&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"> <link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBryantDavid2003" class="citation cs2"><a href="/wiki/Randal_Bryant" title="Randal Bryant">Bryant, Randal E.</a>; David, O'Hallaron (2003), <a rel="nofollow" class="external text" href="http://csapp.cs.cmu.edu/"><i>Computer Systems: A Programmer's Perspective</i></a> (2003 ed.), Upper Saddle River, NJ: Pearson Education, p. 40, <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/0-13-034074-X" title="Special:BookSources/0-13-034074-X"><bdi>0-13-034074-X</bdi></a>, <a rel="nofollow" class="external text" href="https://web.archive.org/web/20070806075942/http://csapp.cs.cmu.edu/">archived</a> from the original on 2007-08-06</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Computer+Systems%3A+A+Programmer%27s+Perspective&rft.place=Upper+Saddle+River%2C+NJ&rft.pages=40&rft.edition=2003&rft.pub=Pearson+Education&rft.date=2003&rft.isbn=0-13-034074-X&rft.aulast=Bryant&rft.aufirst=Randal+E.&rft.au=David%2C+O%27Hallaron&rft_id=http%3A%2F%2Fcsapp.cs.cmu.edu%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-asm-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-asm_12-0">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFWearmouth" class="citation web cs1">Wearmouth, Geoff. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20150815035611/http://www.wearmouth.demon.co.uk/zx80.htm">"An Assembly Listing of the ROM of the Sinclair ZX80"</a>. Archived from the original on August 15, 2015.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=An+Assembly+Listing+of+the+ROM+of+the+Sinclair+ZX80&rft.aulast=Wearmouth&rft.aufirst=Geoff&rft_id=http%3A%2F%2Fwww.wearmouth.demon.co.uk%2Fzx80.htm&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span><span class="cs1-maint citation-comment"><code class="cs1-code">{{<a href="/wiki/Template:Cite_web" title="Template:Cite web">cite web</a>}}</code>: CS1 maint: unfit URL (<a href="/wiki/Category:CS1_maint:_unfit_URL" title="Category:CS1 maint: unfit URL">link</a>)</span></span> </li> <li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFAllison" class="citation web cs1">Allison, Dennis. <a rel="nofollow" class="external text" href="http://www.ittybittycomputers.com/IttyBitty/TinyBasic/DDJ1/Design.html">"Design Notes for Tiny BASIC"</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20170410220759/http://www.ittybittycomputers.com/IttyBitty/TinyBasic/DDJ1/Design.html">Archived</a> from the original on 2017-04-10.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Design+Notes+for+Tiny+BASIC&rft.aulast=Allison&rft.aufirst=Dennis&rft_id=http%3A%2F%2Fwww.ittybittycomputers.com%2FIttyBitty%2FTinyBasic%2FDDJ1%2FDesign.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text"> Charles Crowley. <a rel="nofollow" class="external text" href="http://www.cs.unm.edu/~crowley/papers/sds.pdf">"Data Structures for Text Sequences"</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160304042917/https://www.cs.unm.edu/~crowley/papers/sds.pdf">Archived</a> 2016-03-04 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a>. Section <a rel="nofollow" class="external text" href="http://www.cs.unm.edu/~crowley/papers/sds/node1.html">"Introduction"</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160404020539/http://www.cs.unm.edu/~crowley/papers/sds/node1.html">Archived</a> 2016-04-04 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a>.</span> </li> <li id="cite_note-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-15">^</a></b></span> <span class="reference-text"> <a rel="nofollow" class="external text" href="https://www.sudo.ws/todd/papers/strlcpy.html">"strlcpy and strlcat - consistent, safe, string copy and concatenation."</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160313163321/https://www.sudo.ws/todd/papers/strlcpy.html">Archived</a> 2016-03-13 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a></span> </li> <li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"> <a rel="nofollow" class="external text" href="http://udel.edu/~pconrad/UnixAtUD/strcpy.html">"A rant about strcpy, strncpy and strlcpy."</a> <a rel="nofollow" class="external text" href="https://web.archive.org/web/20160229080205/http://udel.edu/~pconrad/UnixAtUD/strcpy.html">Archived</a> 2016-02-29 at the <a href="/wiki/Wayback_Machine" title="Wayback Machine">Wayback Machine</a></span> </li> <li id="cite_note-17"><span class="mw-cite-backlink"><b><a href="#cite_ref-17">^</a></b></span> <span class="reference-text"> Keith Thompson. "No, strncpy() is not a "safer" strcpy()". 2012.</span> </li> <li id="cite_note-18"><span class="mw-cite-backlink"><b><a href="#cite_ref-18">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.stringology.org/">"The Prague Stringology Club"</a>. <i>stringology.org</i>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20150601001757/http://www.stringology.org/">Archived</a> from the original on 1 June 2015<span class="reference-accessdate">. Retrieved <span class="nowrap">23 May</span> 2015</span>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=stringology.org&rft.atitle=The+Prague+Stringology+Club&rft_id=http%3A%2F%2Fwww.stringology.org%2F&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-19"><span class="mw-cite-backlink"><b><a href="#cite_ref-19">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFEvarts2021" class="citation web cs1">Evarts, Holly (18 March 2021). <a rel="nofollow" class="external text" href="https://www.engineering.columbia.edu/news/zvi-galil-top-10-computer-scientist">"Former Dean Zvi Galil Named a Top 10 Most Influential Computer Scientist in the Past Decade"</a>. <i>Columbia Engineering</i>. <q>He invented the terms 'stringology,' which is a subfield of string algorithms,</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&rft.genre=unknown&rft.jtitle=Columbia+Engineering&rft.atitle=Former+Dean+Zvi+Galil+Named+a+Top+10+Most+Influential+Computer+Scientist+in+the+Past+Decade&rft.date=2021-03-18&rft.aulast=Evarts&rft.aufirst=Holly&rft_id=https%3A%2F%2Fwww.engineering.columbia.edu%2Fnews%2Fzvi-galil-top-10-computer-scientist&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-20"><span class="mw-cite-backlink"><b><a href="#cite_ref-20">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFCrochemore2002" class="citation book cs1">Crochemore, Maxime (2002). <i>Jewels of stringology</i>. Singapore. p. v. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/981-02-4782-6" title="Special:BookSources/981-02-4782-6"><bdi>981-02-4782-6</bdi></a>. <q>The term stringology is a popular nickname for string algorithms as well as for text algorithms.</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Jewels+of+stringology&rft.place=Singapore&rft.pages=v&rft.date=2002&rft.isbn=981-02-4782-6&rft.aulast=Crochemore&rft.aufirst=Maxime&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span><span class="cs1-maint citation-comment"><code class="cs1-code">{{<a href="/wiki/Template:Cite_book" title="Template:Cite book">cite book</a>}}</code>: CS1 maint: location missing publisher (<a href="/wiki/Category:CS1_maint:_location_missing_publisher" title="Category:CS1 maint: location missing publisher">link</a>)</span></span> </li> <li id="cite_note-21"><span class="mw-cite-backlink"><b><a href="#cite_ref-21">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://cslibrary.stanford.edu/108/EssentialPerl.html#re">"Essential Perl"</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20120421014328/http://cslibrary.stanford.edu/108/EssentialPerl.html#re">Archived</a> from the original on 2012-04-21. <q>Perl's most famous strength is in string manipulation with regular expressions.</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=Essential+Perl&rft_id=http%3A%2F%2Fcslibrary.stanford.edu%2F108%2FEssentialPerl.html%23re&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-22"><span class="mw-cite-backlink"><b><a href="#cite_ref-22">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.oracle.com/cd/E19120-01/open.solaris/817-5477/eoizn/index.html">"x86 string instructions"</a>. <a rel="nofollow" class="external text" href="https://web.archive.org/web/20150327220944/http://docs.oracle.com/cd/E19120-01/open.solaris/817-5477/eoizn/index.html">Archived</a> from the original on 2015-03-27.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=unknown&rft.btitle=x86+string+instructions&rft_id=https%3A%2F%2Fdocs.oracle.com%2Fcd%2FE19120-01%2Fopen.solaris%2F817-5477%2Feoizn%2Findex.html&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-23"><span class="mw-cite-backlink"><b><a href="#cite_ref-23">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFFletcherHoylePatty1991" class="citation book cs1">Fletcher, Peter; Hoyle, Hughes; Patty, C. Wayne (1991). <i>Foundations of Discrete Mathematics</i>. PWS-Kent. p. 114. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/0-53492-373-9" title="Special:BookSources/0-53492-373-9"><bdi>0-53492-373-9</bdi></a>. <q>Let Σ be an alphabet. A <b>nonempty word over Σ</b> is a finite sequence with domain <i>I<sub>n</sub></i> (for some <i>n</i> ∈ ℕ) and codomain Σ.</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Foundations+of+Discrete+Mathematics&rft.pages=114&rft.pub=PWS-Kent&rft.date=1991&rft.isbn=0-53492-373-9&rft.aulast=Fletcher&rft.aufirst=Peter&rft.au=Hoyle%2C+Hughes&rft.au=Patty%2C+C.+Wayne&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-24"><span class="mw-cite-backlink"><b><a href="#cite_ref-24">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFShoenfield2010" class="citation book cs1"><a href="/wiki/Joseph_R._Shoenfield" title="Joseph R. Shoenfield">Shoenfield, Joseph R.</a> (2010) [1967]. <i>Mathematical Logic</i> (Reprint ed.). CRC Press. p. 2. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/978-156881135-2" title="Special:BookSources/978-156881135-2"><bdi>978-156881135-2</bdi></a>. <q>Any finite sequence of symbols of a language is called an <i>expression</i> of that language.</q></cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Mathematical+Logic&rft.pages=2&rft.edition=Reprint&rft.pub=CRC+Press&rft.date=2010&rft.isbn=978-156881135-2&rft.aulast=Shoenfield&rft.aufirst=Joseph+R.&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-partee-25"><span class="mw-cite-backlink">^ <a href="#cite_ref-partee_25-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-partee_25-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFBarbara_H._ParteeAlice_ter_MeulenRobert_E._Wall1990" class="citation book cs1">Barbara H. Partee; <a href="/wiki/Alice_ter_Meulen" title="Alice ter Meulen">Alice ter Meulen</a>; Robert E. Wall (1990). <i>Mathematical Methods in Linguistics</i>. Kluwer.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Mathematical+Methods+in+Linguistics&rft.pub=Kluwer&rft.date=1990&rft.au=Barbara+H.+Partee&rft.au=Alice+ter+Meulen&rft.au=Robert+E.+Wall&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span></span> </li> <li id="cite_note-26"><span class="mw-cite-backlink"><b><a href="#cite_ref-26">^</a></b></span> <span class="reference-text"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1238218222"><cite id="CITEREFJohn_E._Hopcroft,_Jeffrey_D._Ullman1979" class="citation book cs1">John E. Hopcroft, Jeffrey D. Ullman (1979). <span class="id-lock-registration" title="Free registration required"><a rel="nofollow" class="external text" href="https://archive.org/details/introductiontoau00hopc"><i>Introduction to Automata Theory, Languages, and Computation</i></a></span>. Addison-Wesley. <a href="/wiki/ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a> <a href="/wiki/Special:BookSources/0-201-02988-X" title="Special:BookSources/0-201-02988-X"><bdi>0-201-02988-X</bdi></a>.</cite><span title="ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Introduction+to+Automata+Theory%2C+Languages%2C+and+Computation&rft.pub=Addison-Wesley&rft.date=1979&rft.isbn=0-201-02988-X&rft.au=John+E.+Hopcroft%2C+Jeffrey+D.+Ullman&rft_id=https%3A%2F%2Farchive.org%2Fdetails%2Fintroductiontoau00hopc&rfr_id=info%3Asid%2Fen.wikipedia.org%3AString+%28computer+science%29" class="Z3988"></span> Here: sect.1.1, p.1</span> </li> </ol></div></div> <div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}</style><style data-mw-deduplicate="TemplateStyles:r1236075235">.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}</style></div><div role="navigation" class="navbox" aria-labelledby="Strings" style="padding:3px"><table class="nowraplinks mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><style data-mw-deduplicate="TemplateStyles:r1239400231">.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}</style><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Strings" title="Template:Strings"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Strings" title="Template talk:Strings"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Strings" title="Special:EditPage/Template:Strings"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Strings" style="font-size:114%;margin:0 4em"><a class="mw-selflink selflink">Strings</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/String_metric" title="String metric">String metric</a></th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Approximate_string_matching" title="Approximate string matching">Approximate string matching</a></li> <li><a href="/wiki/Bitap_algorithm" title="Bitap algorithm">Bitap algorithm</a></li> <li><a href="/wiki/Damerau%E2%80%93Levenshtein_distance" title="Damerau–Levenshtein distance">Damerau–Levenshtein distance</a></li> <li><a href="/wiki/Edit_distance" title="Edit distance">Edit distance</a></li> <li><a href="/wiki/Gestalt_pattern_matching" title="Gestalt pattern matching">Gestalt pattern matching</a></li> <li><a href="/wiki/Hamming_distance" title="Hamming distance">Hamming distance</a></li> <li><a href="/wiki/Jaro%E2%80%93Winkler_distance" title="Jaro–Winkler distance">Jaro–Winkler distance</a></li> <li><a href="/wiki/Lee_distance" title="Lee distance">Lee distance</a></li> <li><a href="/wiki/Levenshtein_automaton" title="Levenshtein automaton">Levenshtein automaton</a></li> <li><a href="/wiki/Levenshtein_distance" title="Levenshtein distance">Levenshtein distance</a></li> <li><a href="/wiki/Wagner%E2%80%93Fischer_algorithm" title="Wagner–Fischer algorithm">Wagner–Fischer algorithm </a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/String-searching_algorithm" title="String-searching algorithm">String-searching algorithm</a></th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Apostolico%E2%80%93Giancarlo_algorithm" title="Apostolico–Giancarlo algorithm">Apostolico–Giancarlo algorithm</a></li> <li><a href="/wiki/Boyer%E2%80%93Moore_string-search_algorithm" title="Boyer–Moore string-search algorithm">Boyer–Moore string-search algorithm</a></li> <li><a href="/wiki/Boyer%E2%80%93Moore%E2%80%93Horspool_algorithm" title="Boyer–Moore–Horspool algorithm">Boyer–Moore–Horspool algorithm</a></li> <li><a href="/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm" title="Knuth–Morris–Pratt algorithm">Knuth–Morris–Pratt algorithm</a></li> <li><a href="/wiki/Rabin%E2%80%93Karp_algorithm" title="Rabin–Karp algorithm">Rabin–Karp algorithm</a></li> <li><a href="/wiki/Raita_algorithm" title="Raita algorithm">Raita algorithm</a></li> <li><a href="/wiki/Trigram_search" title="Trigram search">Trigram search</a></li> <li><a href="/wiki/Two-way_string-matching_algorithm" title="Two-way string-matching algorithm">Two-way string-matching algorithm</a></li> <li><a href="/wiki/Zhu%E2%80%93Takaoka_string_matching_algorithm" title="Zhu–Takaoka string matching algorithm">Zhu–Takaoka string matching algorithm</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Multiple string searching</th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Aho%E2%80%93Corasick_algorithm" title="Aho–Corasick algorithm">Aho–Corasick</a></li> <li><a href="/wiki/Commentz-Walter_algorithm" title="Commentz-Walter algorithm">Commentz-Walter algorithm</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Regular_expression" title="Regular expression">Regular expression</a></th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Comparison_of_regular-expression_engines" class="mw-redirect" title="Comparison of regular-expression engines">Comparison of regular-expression engines</a></li> <li><a href="/wiki/Regular_grammar" title="Regular grammar">Regular grammar</a></li> <li><a href="/wiki/Thompson%27s_construction" title="Thompson's construction">Thompson's construction</a></li> <li><a href="/wiki/Nondeterministic_finite_automaton" title="Nondeterministic finite automaton">Nondeterministic finite automaton</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Sequence_alignment" title="Sequence alignment">Sequence alignment</a></th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/BLAST_(biotechnology)" title="BLAST (biotechnology)">BLAST</a></li> <li><a href="/wiki/Hirschberg%27s_algorithm" title="Hirschberg's algorithm">Hirschberg's algorithm</a></li> <li><a href="/wiki/Needleman%E2%80%93Wunsch_algorithm" title="Needleman–Wunsch algorithm">Needleman–Wunsch algorithm</a></li> <li><a href="/wiki/Smith%E2%80%93Waterman_algorithm" title="Smith–Waterman algorithm">Smith–Waterman algorithm</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Data_structure" title="Data structure">Data structure</a></th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Deterministic_acyclic_finite_state_automaton" title="Deterministic acyclic finite state automaton">DAFSA</a></li> <li><a href="/wiki/Suffix_array" title="Suffix array">Suffix array</a></li> <li><a href="/wiki/Suffix_automaton" title="Suffix automaton">Suffix automaton</a></li> <li><a href="/wiki/Suffix_tree" title="Suffix tree">Suffix tree</a></li> <li><a href="/wiki/Generalized_suffix_tree" title="Generalized suffix tree">Generalized suffix tree</a></li> <li><a href="/wiki/Rope_(data_structure)" title="Rope (data structure)">Rope</a></li> <li><a href="/wiki/Ternary_search_tree" title="Ternary search tree">Ternary search tree</a></li> <li><a href="/wiki/Trie" title="Trie">Trie</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Parsing" title="Parsing">Parsing</a></li> <li><a href="/wiki/Pattern_matching" title="Pattern matching">Pattern matching</a></li> <li><a href="/wiki/Compressed_pattern_matching" title="Compressed pattern matching">Compressed pattern matching</a></li> <li><a href="/wiki/Longest_common_subsequence" title="Longest common subsequence">Longest common subsequence</a></li> <li><a href="/wiki/Longest_common_substring" title="Longest common substring">Longest common substring</a></li> <li><a href="/wiki/Sequential_pattern_mining" title="Sequential pattern mining">Sequential pattern mining</a></li> <li><a href="/wiki/Category:String_sorting_algorithms" title="Category:String sorting algorithms">Sorting</a></li> <li><a href="/wiki/Semi-Thue_system" title="Semi-Thue system">String rewriting systems</a></li> <li><a href="/wiki/String_operations" title="String operations">String operations</a></li></ul> </div></td></tr></tbody></table></div> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236075235"></div><div role="navigation" class="navbox" aria-labelledby="Data_types" style="padding:3px"><table class="nowraplinks hlist mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239400231"><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Data_types" title="Template:Data types"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Data_types" title="Template talk:Data types"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Data_types" title="Special:EditPage/Template:Data types"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Data_types" style="font-size:114%;margin:0 4em"><a href="/wiki/Data_type" title="Data type">Data types</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Units_of_information" title="Units of information">Uninterpreted</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Bit" title="Bit">Bit</a></li> <li><a href="/wiki/Byte" title="Byte">Byte</a></li> <li><a href="/wiki/Ternary_numeral_system" title="Ternary numeral system">Trit</a></li> <li><a href="/wiki/Ternary_numeral_system#Tryte" title="Ternary numeral system">Tryte</a></li> <li><a href="/wiki/Word_(computer_architecture)" title="Word (computer architecture)">Word</a></li> <li><a href="/wiki/Bit_array" title="Bit array">Bit array</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Numeric</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Arbitrary-precision_arithmetic" title="Arbitrary-precision arithmetic">Arbitrary-precision or bignum</a></li> <li><a href="/wiki/Complex_data_type" title="Complex data type">Complex</a></li> <li><a href="/wiki/Decimal_data_type" title="Decimal data type">Decimal</a></li> <li><a href="/wiki/Fixed-point_arithmetic" title="Fixed-point arithmetic">Fixed point</a></li> <li><a href="/wiki/Floating-point_arithmetic" title="Floating-point arithmetic">Floating point</a> <ul><li>Reduced precision <ul><li><a href="/wiki/Minifloat" title="Minifloat">Minifloat</a></li> <li><a href="/wiki/Half-precision_floating-point_format" title="Half-precision floating-point format">Half precision</a></li> <li><a href="/wiki/Bfloat16_floating-point_format" title="Bfloat16 floating-point format">bfloat16</a></li></ul></li> <li><a href="/wiki/Single-precision_floating-point_format" title="Single-precision floating-point format">Single precision</a></li> <li><a href="/wiki/Double-precision_floating-point_format" title="Double-precision floating-point format">Double precision</a></li> <li><a href="/wiki/Quadruple-precision_floating-point_format" title="Quadruple-precision floating-point format">Quadruple precision</a></li> <li><a href="/wiki/Octuple-precision_floating-point_format" title="Octuple-precision floating-point format">Octuple precision</a></li> <li><a href="/wiki/Extended_precision" title="Extended precision">Extended precision</a> <ul><li><a href="/wiki/Long_double" title="Long double">Long double</a></li></ul></li></ul></li> <li><a href="/wiki/Integer_(computer_science)" title="Integer (computer science)">Integer</a> <ul><li><a href="/wiki/Signedness" title="Signedness">signedness</a></li></ul></li> <li><a href="/wiki/Interval_arithmetic#Implementations" title="Interval arithmetic">Interval</a></li> <li><a href="/wiki/Rational_data_type" title="Rational data type">Rational</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Pointer_(computer_programming)" title="Pointer (computer programming)">Pointer</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Memory_address" title="Memory address">Address</a> <ul><li><a href="/wiki/Physical_address" title="Physical address">physical</a></li> <li><a href="/wiki/Virtual_address_space" title="Virtual address space">virtual</a></li></ul></li> <li><a href="/wiki/Reference_(computer_science)" title="Reference (computer science)">Reference</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Plain_text" title="Plain text">Text</a></th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Character_(computing)" title="Character (computing)">Character</a></li> <li><a class="mw-selflink selflink">String</a> <ul><li><a href="/wiki/Null-terminated_string" title="Null-terminated string">null-terminated</a></li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Composite_data_type" title="Composite data type">Composite</a></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Algebraic_data_type" title="Algebraic data type">Algebraic data type</a> <ul><li><a href="/wiki/Generalized_algebraic_data_type" title="Generalized algebraic data type">generalized</a></li></ul></li> <li><a href="/wiki/Array_data_type" class="mw-redirect" title="Array data type">Array</a></li> <li><a href="/wiki/Associative_array" title="Associative array">Associative array</a></li> <li><a href="/wiki/Class_(computer_programming)" title="Class (computer programming)">Class</a></li> <li><a href="/wiki/Dependent_type" title="Dependent type">Dependent</a></li> <li><a href="/wiki/Intuitionistic_type_theory#Equality_type" title="Intuitionistic type theory">Equality</a></li> <li><a href="/wiki/Inductive_type" title="Inductive type">Inductive</a></li> <li><a href="/wiki/Intersection_type" title="Intersection type">Intersection</a></li> <li><a href="/wiki/List_(abstract_data_type)" title="List (abstract data type)">List</a></li> <li><a href="/wiki/Object_(computer_science)" title="Object (computer science)">Object</a> <ul><li><a href="/wiki/Metaobject" title="Metaobject">metaobject</a></li></ul></li> <li><a href="/wiki/Option_type" title="Option type">Option type</a></li> <li><a href="/wiki/Product_type" title="Product type">Product</a></li> <li><a href="/wiki/Record_(computer_science)" title="Record (computer science)">Record or Struct</a></li> <li><a href="/wiki/Refinement_type" title="Refinement type">Refinement</a></li> <li><a href="/wiki/Set_(abstract_data_type)" title="Set (abstract data type)">Set</a></li> <li><a href="/wiki/Union_type" title="Union type">Union</a> <ul><li><a href="/wiki/Tagged_union" title="Tagged union">tagged</a></li></ul></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-even" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Boolean_data_type" title="Boolean data type">Boolean</a></li> <li><a href="/wiki/Bottom_type" title="Bottom type">Bottom type</a></li> <li><a href="/wiki/Container_(abstract_data_type)" title="Container (abstract data type)">Collection</a></li> <li><a href="/wiki/Enumerated_type" title="Enumerated type">Enumerated type</a></li> <li><a href="/wiki/Exception_handling" title="Exception handling">Exception</a></li> <li><a href="/wiki/Function_type" title="Function type">Function type</a></li> <li><a href="/wiki/Opaque_data_type" title="Opaque data type">Opaque data type</a></li> <li><a href="/wiki/Recursive_data_type" title="Recursive data type">Recursive data type</a></li> <li><a href="/wiki/Semaphore_(programming)" title="Semaphore (programming)">Semaphore</a></li> <li><a href="/wiki/Stream_(computing)" title="Stream (computing)">Stream</a></li> <li><a href="/wiki/Strongly_typed_identifier" title="Strongly typed identifier">Strongly typed identifier</a></li> <li><a href="/wiki/Top_type" title="Top type">Top type</a></li> <li><a href="/wiki/Type_class" title="Type class">Type class</a></li> <li><a href="/wiki/Empty_type" title="Empty type">Empty type</a></li> <li><a href="/wiki/Unit_type" title="Unit type">Unit type</a></li> <li><a href="/wiki/Void_type" title="Void type">Void</a></li></ul> </div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Related<br />topics</th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"> <ul><li><a href="/wiki/Abstract_data_type" title="Abstract data type">Abstract data type</a></li> <li><a href="/wiki/Boxing_(computer_science)" class="mw-redirect" title="Boxing (computer science)">Boxing</a></li> <li><a href="/wiki/Data_structure" title="Data structure">Data structure</a></li> <li><a href="/wiki/Generic_programming" title="Generic programming">Generic</a></li> <li><a href="/wiki/Kind_(type_theory)" title="Kind (type theory)">Kind</a> <ul><li><a href="/wiki/Metaclass" title="Metaclass">metaclass</a></li></ul></li> <li><a href="/wiki/Parametric_polymorphism" title="Parametric polymorphism">Parametric polymorphism</a></li> <li><a href="/wiki/Primitive_data_type" title="Primitive data type">Primitive data type</a></li> <li><a href="/wiki/Interface_(object-oriented_programming)" title="Interface (object-oriented programming)">Interface</a></li> <li><a href="/wiki/Subtyping" title="Subtyping">Subtyping</a></li> <li><a href="/wiki/Type_constructor" title="Type constructor">Type constructor</a></li> <li><a href="/wiki/Type_conversion" title="Type conversion">Type conversion</a></li> <li><a href="/wiki/Type_system" title="Type system">Type system</a></li> <li><a href="/wiki/Type_theory" title="Type theory">Type theory</a></li> <li><a href="/wiki/Variable_(computer_science)" title="Variable (computer science)">Variable</a></li></ul> </div></td></tr></tbody></table></div> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><style data-mw-deduplicate="TemplateStyles:r1126788409">.mw-parser-output .plainlist ol,.mw-parser-output .plainlist ul{line-height:inherit;list-style:none;margin:0;padding:0}.mw-parser-output .plainlist ol li,.mw-parser-output .plainlist ul li{margin-bottom:0}</style><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236075235"></div><div role="navigation" class="navbox" aria-labelledby="Automata_theory:_formal_languages_and_formal_grammars" style="padding:3px"><table class="nowraplinks mw-collapsible mw-collapsed navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1239400231"><div class="navbar plainlinks hlist navbar-mini"><ul><li class="nv-view"><a href="/wiki/Template:Formal_languages_and_grammars" title="Template:Formal languages and grammars"><abbr title="View this template">v</abbr></a></li><li class="nv-talk"><a href="/wiki/Template_talk:Formal_languages_and_grammars" title="Template talk:Formal languages and grammars"><abbr title="Discuss this template">t</abbr></a></li><li class="nv-edit"><a href="/wiki/Special:EditPage/Template:Formal_languages_and_grammars" title="Special:EditPage/Template:Formal languages and grammars"><abbr title="Edit this template">e</abbr></a></li></ul></div><div id="Automata_theory:_formal_languages_and_formal_grammars" style="font-size:114%;margin:0 4em"><a href="/wiki/Automata_theory" title="Automata theory">Automata theory</a>: <a href="/wiki/Formal_language" title="Formal language">formal languages</a> and <a href="/wiki/Formal_grammar" title="Formal grammar">formal grammars</a></div></th></tr><tr><td colspan="2" class="navbox-list navbox-odd plainlist" style="width:100%;padding:0;background:transparent;color:inherit;"><div style="padding:0px"><table class="navbox-columns-table" style="border-spacing: 0px; text-align:left;width:100%;"><tbody><tr><td class="navbox-abovebelow" style="font-weight:bold;"><a href="/wiki/Chomsky_hierarchy" title="Chomsky hierarchy">Chomsky hierarchy</a></td><td class="navbox-abovebelow" style="border-left:2px solid #fdfdfd;font-weight:bold;"><a href="/wiki/Formal_grammar" title="Formal grammar">Grammars</a></td><td class="navbox-abovebelow" style="border-left:2px solid #fdfdfd;font-weight:bold;"><a href="/wiki/Formal_language" title="Formal language">Languages</a></td><td class="navbox-abovebelow" style="border-left:2px solid #fdfdfd;font-weight:bold;"><a href="/wiki/Abstract_machine" title="Abstract machine">Abstract machines</a></td></tr><tr style="vertical-align:top"><td class="navbox-list" style="padding:0px;text-align: center;width:10em;"><div> <ul><li>Type-0</li> <li>—</li> <li>Type-1</li> <li>—</li> <li>—</li> <li>—</li> <li>—</li> <li>—</li> <li>Type-2</li> <li>—</li> <li>—</li> <li>Type-3</li> <li>—</li> <li>—</li></ul> </div></td><td class="navbox-list" style="border-left:2px solid #fdfdfd;padding:0px;width:10em;"><div> <ul><li><a href="/wiki/Unrestricted_grammar" title="Unrestricted grammar">Unrestricted</a></li> <li>(no common name)</li> <li><a href="/wiki/Context-sensitive_grammar" title="Context-sensitive grammar">Context-sensitive</a></li> <li><span style="white-space:nowrap;">Positive <a href="/wiki/Range_concatenation_grammars" class="mw-redirect" title="Range concatenation grammars">range concatenation</a></span></li> <li><a href="/wiki/Indexed_grammar" title="Indexed grammar">Indexed</a></li> <li>—</li> <li><a href="/wiki/Linear_context-free_rewriting_system" class="mw-redirect" title="Linear context-free rewriting system">Linear context-free rewriting systems</a></li> <li><a href="/wiki/Tree-adjoining_grammar" title="Tree-adjoining grammar">Tree-adjoining</a></li> <li><a href="/wiki/Context-free_grammar" title="Context-free grammar">Context-free</a></li> <li><a href="/wiki/Deterministic_context-free_grammar" title="Deterministic context-free grammar">Deterministic context-free</a></li> <li><a href="/wiki/Nested_word" title="Nested word">Visibly pushdown</a></li> <li><a href="/wiki/Regular_grammar" title="Regular grammar">Regular</a></li> <li>—</li> <li><a href="/wiki/Non-recursive_grammar" class="mw-redirect" title="Non-recursive grammar">Non-recursive</a></li></ul> </div></td><td class="navbox-list" style="border-left:2px solid #fdfdfd;padding:0px;width:10em;"><div> <ul><li><a href="/wiki/Recursively_enumerable_language" title="Recursively enumerable language">Recursively enumerable</a></li> <li><a href="/wiki/Recursive_language" title="Recursive language">Decidable</a></li> <li><a href="/wiki/Context-sensitive_language" title="Context-sensitive language">Context-sensitive</a></li> <li><span style="white-space:nowrap;">Positive <a href="/wiki/Range_concatenation_language" class="mw-redirect" title="Range concatenation language">range concatenation</a><sup>*</sup></span></li> <li><a href="/wiki/Indexed_language" title="Indexed language">Indexed</a><sup>*</sup></li> <li>—</li> <li><a href="/wiki/Linear_context-free_rewriting_language" class="mw-redirect" title="Linear context-free rewriting language">Linear context-free rewriting language</a></li> <li><a href="/wiki/Tree-adjoining_grammar" title="Tree-adjoining grammar">Tree-adjoining</a></li> <li><a href="/wiki/Context-free_language" title="Context-free language">Context-free</a></li> <li><a href="/wiki/Deterministic_context-free_language" title="Deterministic context-free language">Deterministic context-free</a></li> <li><a href="/wiki/Nested_word" title="Nested word">Visibly pushdown</a></li> <li><a href="/wiki/Regular_language" title="Regular language">Regular</a></li> <li><a href="/wiki/Star-free_language" title="Star-free language">Star-free</a></li> <li><a href="/wiki/Finite_language" class="mw-redirect" title="Finite language">Finite</a></li></ul> </div></td><td class="navbox-list" style="border-left:2px solid #fdfdfd;padding:0px;width:10em;"><div> <ul><li><a href="/wiki/Turing_machine" title="Turing machine">Turing machine</a></li> <li><a href="/wiki/Decider_(Turing_machine)" title="Decider (Turing machine)">Decider</a></li> <li><a href="/wiki/Linear_bounded_automaton" title="Linear bounded automaton">Linear-bounded</a></li> <li><a href="/wiki/PTIME" class="mw-redirect" title="PTIME">PTIME</a> Turing Machine</li> <li><a href="/wiki/Nested_stack_automaton" title="Nested stack automaton">Nested stack</a></li> <li><a href="/wiki/Thread_automaton" title="Thread automaton">Thread automaton</a></li> <li>restricted <a href="/wiki/Tree_stack_automaton" title="Tree stack automaton">Tree stack automaton</a></li> <li><a href="/wiki/Embedded_pushdown_automaton" title="Embedded pushdown automaton">Embedded pushdown</a></li> <li><a href="/wiki/Pushdown_automaton" title="Pushdown automaton">Nondeterministic pushdown</a></li> <li><a href="/wiki/Deterministic_pushdown_automaton" title="Deterministic pushdown automaton">Deterministic pushdown</a></li> <li><a href="/wiki/Nested_word" title="Nested word">Visibly pushdown</a></li> <li><a href="/wiki/Finite-state_machine" title="Finite-state machine">Finite</a></li> <li><a href="/wiki/Aperiodic_finite_state_automaton" title="Aperiodic finite state automaton">Counter-free (with aperiodic finite monoid)</a></li> <li><a href="/wiki/Deterministic_acyclic_finite_state_automaton" title="Deterministic acyclic finite state automaton">Acyclic finite</a></li></ul> </div></td></tr></tbody></table></div></td></tr><tr><td class="navbox-abovebelow" colspan="2"><div><span style="white-space:nowrap;">Each category of languages, except those marked by a <sup>*</sup>, is a <a href="/wiki/Proper_subset" class="mw-redirect" title="Proper subset">proper subset</a> of the category directly above it.</span> <span style="white-space:nowrap;">Any language in each category is generated by a grammar and by an automaton in the category in the same line.</span></div></td></tr></tbody></table></div> <div class="navbox-styles"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1129693374"><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1236075235"><style data-mw-deduplicate="TemplateStyles:r1038841319">.mw-parser-output .tooltip-dotted{border-bottom:1px dotted;cursor:help}</style><link rel="mw-deduplicated-inline-style" href="mw-data:TemplateStyles:r1038841319"></div><div role="navigation" class="navbox authority-control" aria-label="Navbox" style="padding:3px"><table class="nowraplinks hlist navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="row" class="navbox-group" style="width:1%"><a href="/wiki/Help:Authority_control" title="Help:Authority control">Authority control databases</a>: National <span class="mw-valign-text-top noprint" typeof="mw:File/Frameless"><a href="https://www.wikidata.org/wiki/Q184754#identifiers" title="Edit this at Wikidata"><img alt="Edit this at Wikidata" src="//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/10px-OOjs_UI_icon_edit-ltr-progressive.svg.png" decoding="async" width="10" height="10" class="mw-file-element" srcset="//upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/15px-OOjs_UI_icon_edit-ltr-progressive.svg.png 1.5x, //upload.wikimedia.org/wikipedia/en/thumb/8/8a/OOjs_UI_icon_edit-ltr-progressive.svg/20px-OOjs_UI_icon_edit-ltr-progressive.svg.png 2x" data-file-width="20" data-file-height="20" /></a></span></th><td class="navbox-list-with-group navbox-list navbox-odd" style="width:100%;padding:0"><div style="padding:0 0.25em"><ul><li><span class="uid"><span class="rt-commentedText tooltip tooltip-dotted" title="Zeichenkette"><a rel="nofollow" class="external text" href="https://d-nb.info/gnd/4067448-4">Germany</a></span></span></li><li><span class="uid"><span class="rt-commentedText tooltip tooltip-dotted" title="řetězce znaků"><a rel="nofollow" class="external text" href="https://aleph.nkp.cz/F/?func=find-c&local_base=aut&ccl_term=ica=ph195841&CON_LNG=ENG">Czech Republic</a></span></span></li></ul></div></td></tr></tbody></table></div> <!-- NewPP limit report Parsed by mw‐web.codfw.main‐5857dfdcd6‐8fpkq Cached time: 20241203065111 Cache expiry: 2592000 Reduced expiry: false Complications: [vary‐revision‐sha1, show‐toc] CPU time usage: 0.641 seconds Real time usage: 0.976 seconds Preprocessor visited node count: 2440/1000000 Post‐expand include size: 85916/2097152 bytes Template argument size: 1747/2097152 bytes Highest expansion depth: 12/100 Expensive parser function count: 13/500 Unstrip recursion depth: 1/20 Unstrip post‐expand size: 111112/5000000 bytes Lua time usage: 0.384/10.000 seconds Lua memory usage: 6461335/52428800 bytes Number of Wikibase entities loaded: 1/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 763.190 1 -total 33.16% 253.081 1 Template:Reflist 19.40% 148.031 10 Template:Cite_web 14.11% 107.713 1 Template:Short_description 12.18% 92.941 1 Template:Strings 12.18% 92.924 2 Template:Navbox 8.33% 63.590 2 Template:Pagetype 7.70% 58.781 1 Template:Authority_control 6.62% 50.557 4 Template:Code 6.62% 50.513 1 Template:Clarify --> <!-- Saved in parser cache with key enwiki:pcache:27701:|#|:idhash:canonical and timestamp 20241203065111 and revision id 1260782846. Rendering was triggered because: page-view --> </div><!--esi <esi:include src="/esitest-fa8a495983347898/content" /> --><noscript><img src="https://login.wikimedia.org/wiki/Special:CentralAutoLogin/start?type=1x1&useformat=desktop" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Retrieved from "<a dir="ltr" href="https://en.wikipedia.org/w/index.php?title=String_(computer_science)&oldid=1260782846">https://en.wikipedia.org/w/index.php?title=String_(computer_science)&oldid=1260782846</a>"</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Help:Category" title="Help:Category">Categories</a>: <ul><li><a href="/wiki/Category:String_(computer_science)" title="Category:String (computer science)">String (computer science)</a></li><li><a href="/wiki/Category:Character_encoding" title="Category:Character encoding">Character encoding</a></li><li><a href="/wiki/Category:Data_types" title="Category:Data types">Data types</a></li><li><a href="/wiki/Category:Formal_languages" title="Category:Formal languages">Formal languages</a></li><li><a href="/wiki/Category:Combinatorics_on_words" title="Category:Combinatorics on words">Combinatorics on words</a></li><li><a href="/wiki/Category:Primitive_types" title="Category:Primitive types">Primitive types</a></li><li><a href="/wiki/Category:Syntactic_entities" title="Category:Syntactic entities">Syntactic entities</a></li><li><a href="/wiki/Category:Algorithms_on_strings" title="Category:Algorithms on strings">Algorithms on strings</a></li></ul></div><div id="mw-hidden-catlinks" class="mw-hidden-catlinks mw-hidden-cats-hidden">Hidden categories: <ul><li><a href="/wiki/Category:CS1_maint:_unfit_URL" title="Category:CS1 maint: unfit URL">CS1 maint: unfit URL</a></li><li><a href="/wiki/Category:Webarchive_template_wayback_links" title="Category:Webarchive template wayback links">Webarchive template wayback links</a></li><li><a href="/wiki/Category:CS1_maint:_location_missing_publisher" title="Category:CS1 maint: location missing publisher">CS1 maint: location missing publisher</a></li><li><a href="/wiki/Category:Articles_with_short_description" title="Category:Articles with short description">Articles with short description</a></li><li><a href="/wiki/Category:Short_description_is_different_from_Wikidata" title="Category:Short description is different from Wikidata">Short description is different from Wikidata</a></li><li><a href="/wiki/Category:Wikipedia_articles_needing_clarification_from_June_2015" title="Category:Wikipedia articles needing clarification from June 2015">Wikipedia articles needing clarification from June 2015</a></li></ul></div></div> </div> </main> </div> <div class="mw-footer-container"> <footer id="footer" class="mw-footer" > <ul id="footer-info"> <li id="footer-info-lastmod"> This page was last edited on 2 December 2024, at 16:24<span class="anonymous-show"> (UTC)</span>.</li> <li id="footer-info-copyright">Text is available under the <a href="/wiki/Wikipedia:Text_of_the_Creative_Commons_Attribution-ShareAlike_4.0_International_License" title="Wikipedia:Text of the Creative Commons Attribution-ShareAlike 4.0 International License">Creative Commons Attribution-ShareAlike 4.0 License</a>; additional terms may apply. By using this site, you agree to the <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use" class="extiw" title="foundation:Special:MyLanguage/Policy:Terms of Use">Terms of Use</a> and <a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy" class="extiw" title="foundation:Special:MyLanguage/Policy:Privacy policy">Privacy Policy</a>. Wikipedia® is a registered trademark of the <a rel="nofollow" class="external text" href="https://wikimediafoundation.org/">Wikimedia Foundation, Inc.</a>, a non-profit organization.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Privacy policy</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:About">About Wikipedia</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:General_disclaimer">Disclaimers</a></li> <li id="footer-places-contact"><a href="//en.wikipedia.org/wiki/Wikipedia:Contact_us">Contact Wikipedia</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Code of Conduct</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Developers</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/en.wikipedia.org">Statistics</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Cookie statement</a></li> <li id="footer-places-mobileview"><a href="//en.m.wikipedia.org/w/index.php?title=String_(computer_science)&mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Mobile view</a></li> </ul> <ul id="footer-icons" class="noprint"> <li id="footer-copyrightico"><a href="https://wikimediafoundation.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/static/images/footer/wikimedia-button.svg" width="84" height="29" alt="Wikimedia Foundation" loading="lazy"></a></li> <li id="footer-poweredbyico"><a href="https://www.mediawiki.org/" class="cdx-button cdx-button--fake-button cdx-button--size-large cdx-button--fake-button--enabled"><img src="/w/resources/assets/poweredby_mediawiki.svg" alt="Powered by MediaWiki" width="88" height="31" loading="lazy"></a></li> </ul> </footer> </div> </div> </div> <div class="vector-settings" id="p-dock-bottom"> <ul></ul> </div><script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgHostname":"mw-web.codfw.main-5945864d7d-c77hh","wgBackendResponseTime":159,"wgPageParseReport":{"limitreport":{"cputime":"0.641","walltime":"0.976","ppvisitednodes":{"value":2440,"limit":1000000},"postexpandincludesize":{"value":85916,"limit":2097152},"templateargumentsize":{"value":1747,"limit":2097152},"expansiondepth":{"value":12,"limit":100},"expensivefunctioncount":{"value":13,"limit":500},"unstrip-depth":{"value":1,"limit":20},"unstrip-size":{"value":111112,"limit":5000000},"entityaccesscount":{"value":1,"limit":400},"timingprofile":["100.00% 763.190 1 -total"," 33.16% 253.081 1 Template:Reflist"," 19.40% 148.031 10 Template:Cite_web"," 14.11% 107.713 1 Template:Short_description"," 12.18% 92.941 1 Template:Strings"," 12.18% 92.924 2 Template:Navbox"," 8.33% 63.590 2 Template:Pagetype"," 7.70% 58.781 1 Template:Authority_control"," 6.62% 50.557 4 Template:Code"," 6.62% 50.513 1 Template:Clarify"]},"scribunto":{"limitreport-timeusage":{"value":"0.384","limit":"10.000"},"limitreport-memusage":{"value":6461335,"limit":52428800}},"cachereport":{"origin":"mw-web.codfw.main-5857dfdcd6-8fpkq","timestamp":"20241203065111","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"String (computer science)","url":"https:\/\/en.wikipedia.org\/wiki\/String_(computer_science)","sameAs":"http:\/\/www.wikidata.org\/entity\/Q184754","mainEntity":"http:\/\/www.wikidata.org\/entity\/Q184754","author":{"@type":"Organization","name":"Contributors to Wikimedia projects"},"publisher":{"@type":"Organization","name":"Wikimedia Foundation, Inc.","logo":{"@type":"ImageObject","url":"https:\/\/www.wikimedia.org\/static\/images\/wmf-hor-googpub.png"}},"datePublished":"2001-07-27T08:19:06Z","dateModified":"2024-12-02T16:24:59Z","image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/6\/6b\/String_example.png","headline":"data type representing a finite sequence of encoded characters"}</script> </body> </html>