CINXE.COM

Strengur (tölvunarfræði) - Wikipedia, frjálsa alfræðiritið

<!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="is" dir="ltr"> <head> <meta charset="UTF-8"> <title>Strengur (tölvunarfræði) - Wikipedia, frjálsa alfræðiritið</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(/(?:^|; )iswikimwclientpreferences=([^;]+)/);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":[",\t.",".\t,"],"wgDigitTransformTable":["",""], "wgDefaultDateFormat":"dmyt","wgMonthNames":["","janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],"wgRequestId":"7778a1fe-5daf-4c3e-93bd-a8863bd7bcef","wgCanonicalNamespace":"","wgCanonicalSpecialPageName":false,"wgNamespaceNumber":0,"wgPageName":"Strengur_(tölvunarfræði)","wgTitle":"Strengur (tölvunarfræði)","wgCurRevisionId":1377627,"wgRevisionId":1377627,"wgArticleId":39175,"wgIsArticle":true,"wgIsRedirect":false,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":["Gagnagerðir"],"wgPageViewLanguage":"is","wgPageContentLanguage":"is","wgPageContentModel":"wikitext","wgRelevantPageName":"Strengur_(tölvunarfræði)","wgRelevantArticleId":39175,"wgIsProbablyEditable":true,"wgRelevantPageIsProbablyEditable":true,"wgRestrictionEdit":[],"wgRestrictionMove":[],"wgNoticeProject":"wikipedia","wgCiteReferencePreviewsActive":true,"wgMediaViewerOnClick":true,"wgMediaViewerEnabledByDefault":true, "wgPopupsFlags":0,"wgVisualEditor":{"pageLanguageCode":"is","pageLanguageDir":"ltr","pageVariantFallbacks":"is"},"wgMFDisplayWikibaseDescriptions":{"search":true,"watchlist":true,"tagline":true,"nearby":true},"wgWMESchemaEditAttemptStepOversample":false,"wgWMEPageLength":1000,"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.gadget.graabot":"ready","ext.globalCssJs.user.styles":"ready","site.styles":"ready","user.styles":"ready","ext.globalCssJs.user":"ready","user":"ready", "user.options":"loading","skins.vector.search.codex.styles":"ready","skins.vector.styles":"ready","skins.vector.icons":"ready","ext.wikimediamessages.styles":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready","ext.uls.interlanguage":"ready","wikibase.client.init":"ready","ext.wikimediaBadges":"ready"};RLPAGEMODULES=["site","mediawiki.page.ready","mediawiki.toc","skins.vector.js","ext.centralNotice.geoIP","ext.centralNotice.startUp","ext.urlShortener.toolbar","ext.centralauth.centralautologin","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.growthExperiments.SuggestedEditSession"];</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=is&amp;modules=ext.uls.interlanguage%7Cext.visualEditor.desktopArticleTarget.noscript%7Cext.wikimediaBadges%7Cext.wikimediamessages.styles%7Cskins.vector.icons%2Cstyles%7Cskins.vector.search.codex.styles%7Cwikibase.client.init&amp;only=styles&amp;skin=vector-2022"> <script async="" src="/w/load.php?lang=is&amp;modules=startup&amp;only=scripts&amp;raw=1&amp;skin=vector-2022"></script> <meta name="ResourceLoaderDynamicStyles" content=""> <link rel="stylesheet" href="/w/load.php?lang=is&amp;modules=ext.gadget.graabot&amp;only=styles&amp;skin=vector-2022"> <link rel="stylesheet" href="/w/load.php?lang=is&amp;modules=site.styles&amp;only=styles&amp;skin=vector-2022"> <meta name="generator" content="MediaWiki 1.44.0-wmf.6"> <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 name="viewport" content="width=1120"> <meta property="og:title" content="Strengur (tölvunarfræði) - Wikipedia, frjálsa alfræðiritið"> <meta property="og:type" content="website"> <link rel="alternate" media="only screen and (max-width: 640px)" href="//is.m.wikipedia.org/wiki/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)"> <link rel="alternate" type="application/x-wiki" title="Breyta" href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;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 (is)"> <link rel="EditURI" type="application/rsd+xml" href="//is.wikipedia.org/w/api.php?action=rsd"> <link rel="canonical" href="https://is.wikipedia.org/wiki/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)"> <link rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/deed.is"> <link rel="alternate" type="application/atom+xml" title="Wikipedia Atom-streymi" href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:N%C3%BDlegar_breytingar&amp;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-Strengur_tölvunarfræði rootpage-Strengur_tölvunarfræði skin-vector-2022 action-view"><a class="mw-jump-link" href="#bodyContent">Fara í innihald</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="Vefsíða"> <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="Aðalvalmynd" > <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">Aðalvalmynd</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">Aðalvalmynd</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-main-menu.pin">færa í hliðarstiku</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-main-menu.unpin">fela</button> </div> <div id="p-navigation" class="vector-menu mw-portlet mw-portlet-navigation" > <div class="vector-menu-heading"> Flakk </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-mainpage" class="mw-list-item"><a href="/wiki/Fors%C3%AD%C3%B0a" title="Forsíða Wikipedia [z]" accesskey="z"><span>Forsíða</span></a></li><li id="n-Úrvalsefni" class="mw-list-item"><a href="/wiki/G%C3%A1tt:%C3%9Arvalsefni"><span>Úrvalsefni</span></a></li><li id="n-Efnisyfirlit" class="mw-list-item"><a href="/wiki/Flokkur:Efnisyfirlit"><span>Efnisyfirlit</span></a></li><li id="n-randompage" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:Handah%C3%B3fsvalin_s%C3%AD%C3%B0a" title="Handahófsvalin síða [x]" accesskey="x"><span>Handahófsvalin síða</span></a></li><li id="n-help" class="mw-list-item"><a href="/wiki/Hj%C3%A1lp:Efnisyfirlit" title="Efnisyfirlit yfir hjálparsíður."><span>Hjálp</span></a></li> </ul> </div> </div> <div id="p-verkefnið" class="vector-menu mw-portlet mw-portlet-verkefnið" > <div class="vector-menu-heading"> Verkefnið </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="n-recentchanges" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:N%C3%BDlegar_breytingar" title="Listi yfir nýlegar breytingar. [r]" accesskey="r"><span>Nýlegar breytingar</span></a></li><li id="n-newpages" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:N%C3%BDjustu_greinar"><span>Nýjustu greinar</span></a></li><li id="n-portal" class="mw-list-item"><a href="/wiki/Wikipedia:Samf%C3%A9lagsg%C3%A1tt" title="Um verkefnið, hvernig er hægt að hjálpa og hvar á að byrja"><span>Samfélagsgátt</span></a></li><li id="n-Potturinn" class="mw-list-item"><a href="/wiki/Wikipedia:Potturinn"><span>Potturinn</span></a></li> </ul> </div> </div> </div> </div> </div> </div> </nav> <a href="/wiki/Fors%C3%AD%C3%B0a" 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="Frjálsa alfræðiritið" src="/static/images/mobile/copyright/wikipedia-tagline-is.svg" width="118" height="12" style="width: 7.375em; height: 0.75em;"> </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/Kerfiss%C3%AD%C3%B0a:Leit" class="cdx-button cdx-button--fake-button cdx-button--fake-button--enabled cdx-button--weight-quiet cdx-button--icon-only search-toggle" title="Leit á þessari Wiki [f]" accesskey="f"><span class="vector-icon mw-ui-icon-search mw-ui-icon-wikimedia-search"></span> <span>Leit</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="Leita á Wikipedia" aria-label="Leita á Wikipedia" autocapitalize="sentences" title="Leit á þessari Wiki [f]" accesskey="f" id="searchInput" > <span class="cdx-text-input__icon cdx-text-input__start-icon"></span> </div> <input type="hidden" name="title" value="Kerfissíða:Leit"> </div> <button class="cdx-button cdx-search-input__end-button">Leita</button> </form> </div> </div> </div> <nav class="vector-user-links vector-user-links-wide" aria-label="Persónuleg verkfæri"> <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="Útlit"> <div id="vector-appearance-dropdown" class="vector-dropdown " title="Breyttu leturstærð, breidd og bakgrunnslit vefsíðunnar" > <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="Útlit" > <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">Útlit</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/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=is.wikipedia.org&amp;uselang=is" class=""><span>Fjárframlög</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=Kerfiss%C3%AD%C3%B0a:B%C3%BAa_til_a%C3%B0gang&amp;returnto=Strengur+%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29" title="Þú ert hvattur/hvött til að búa til aðgang og skrá þig inn; en það er ekki skylda" class=""><span>Búa til aðgang</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=Kerfiss%C3%AD%C3%B0a:Innskr%C3%A1&amp;returnto=Strengur+%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29" title="Þú ert hvattur/hvött til að innskrá þig, það er hinsvegar ekki skylda. [o]" accesskey="o" class=""><span>Skrá inn</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="Frekari valkostir" > <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="Persónuleg verkfæri" > <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">Persónuleg verkfæri</span> </label> <div class="vector-dropdown-content"> <div id="p-personal" class="vector-menu mw-portlet mw-portlet-personal" title="Notandavalmynd" > <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/?wmf_source=donate&amp;wmf_medium=sidebar&amp;wmf_campaign=is.wikipedia.org&amp;uselang=is"><span>Fjárframlög</span></a></li><li id="pt-contribute" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:Contribute"><span class="vector-icon mw-ui-icon-edit mw-ui-icon-wikimedia-edit"></span> <span>Taka þátt</span></a></li><li id="pt-createaccount" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:B%C3%BAa_til_a%C3%B0gang&amp;returnto=Strengur+%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29" title="Þú ert hvattur/hvött til að búa til aðgang og skrá þig inn; en það er ekki skylda"><span class="vector-icon mw-ui-icon-userAdd mw-ui-icon-wikimedia-userAdd"></span> <span>Búa til aðgang</span></a></li><li id="pt-login" class="user-links-collapsible-item mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:Innskr%C3%A1&amp;returnto=Strengur+%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29" title="Þú ert hvattur/hvött til að innskrá þig, það er hinsvegar ekki skylda. [o]" accesskey="o"><span class="vector-icon mw-ui-icon-logIn mw-ui-icon-wikimedia-logIn"></span> <span>Skrá inn</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"> Síður fyrir útskráða notendur <a href="/wiki/Hj%C3%A1lp:Introduction" aria-label="Læra meira um breytingar"><span>Læra meira</span></a> </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="pt-anontalk" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:Spjallas%C3%AD%C3%B0a_m%C3%ADn" title="Spjall um breytingar frá þessu IP-staðfangi [n]" accesskey="n"><span>Spjall</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="Vefsíða"> <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="Efni" 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">Efni</h2> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-toc.pin">færa í hliðarstiku</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-toc.unpin">fela</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">Byrjun</div> </a> </li> <li id="toc-Dæmi_um_gilda_strengi_í_Java" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Dæmi_um_gilda_strengi_í_Java"> <div class="vector-toc-text"> <span class="vector-toc-numb">1</span> <span>Dæmi um gilda strengi í Java</span> </div> </a> <ul id="toc-Dæmi_um_gilda_strengi_í_Java-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Dæmi_úr_Java-kóða" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Dæmi_úr_Java-kóða"> <div class="vector-toc-text"> <span class="vector-toc-numb">2</span> <span>Dæmi úr Java-kóða</span> </div> </a> <ul id="toc-Dæmi_úr_Java-kóða-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Tengt_efni" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Tengt_efni"> <div class="vector-toc-text"> <span class="vector-toc-numb">3</span> <span>Tengt efni</span> </div> </a> <ul id="toc-Tengt_efni-sublist" class="vector-toc-list"> </ul> </li> <li id="toc-Heimildir" class="vector-toc-list-item vector-toc-level-1 vector-toc-list-item-expanded"> <a class="vector-toc-link" href="#Heimildir"> <div class="vector-toc-text"> <span class="vector-toc-numb">4</span> <span>Heimildir</span> </div> </a> <ul id="toc-Heimildir-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="Efni" 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="Sýna/fela efnisyfirlit" > <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">Sýna/fela efnisyfirlit</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">Strengur (tölvunarfræði)</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="Fara á grein á öðru tungumáli. Til staðar á 43 tungumálum" > <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 tungumál</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) – afríkanska" lang="af" hreflang="af" data-title="String (rekenaarwetenskap)" data-language-autonym="Afrikaans" data-language-local-name="afríkanska" 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="سلسلة (علم الحاسوب) – arabíska" lang="ar" hreflang="ar" data-title="سلسلة (علم الحاسوب)" data-language-autonym="العربية" data-language-local-name="arabíska" class="interlanguage-link-target"><span>العربية</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="Радковы тып – hvítrússneska" lang="be" hreflang="be" data-title="Радковы тып" data-language-autonym="Беларуская" data-language-local-name="hvítrússneska" 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="Низ – búlgarska" lang="bg" hreflang="bg" data-title="Низ" data-language-autonym="Български" data-language-local-name="búlgarska" 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) – katalónska" lang="ca" hreflang="ca" data-title="Cadena (informàtica)" data-language-autonym="Català" data-language-local-name="katalónska" class="interlanguage-link-target"><span>Català</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="زنجیرەنووسە – miðkúrdíska" lang="ckb" hreflang="ckb" data-title="زنجیرەنووسە" data-language-autonym="کوردی" data-language-local-name="miðkúrdíska" class="interlanguage-link-target"><span>کوردی</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 – tékkneska" lang="cs" hreflang="cs" data-title="Textový řetězec" data-language-autonym="Čeština" data-language-local-name="tékkneska" 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 – danska" lang="da" hreflang="da" data-title="Tekststreng" data-language-autonym="Dansk" data-language-local-name="danska" 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 – þýska" lang="de" hreflang="de" data-title="Zeichenkette" data-language-autonym="Deutsch" data-language-local-name="þýska" class="interlanguage-link-target"><span>Deutsch</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="Συμβολοσειρά – gríska" lang="el" hreflang="el" data-title="Συμβολοσειρά" data-language-autonym="Ελληνικά" data-language-local-name="gríska" class="interlanguage-link-target"><span>Ελληνικά</span></a></li><li class="interlanguage-link interwiki-en mw-list-item"><a href="https://en.wikipedia.org/wiki/String_(computer_science)" title="String (computer science) – enska" lang="en" hreflang="en" data-title="String (computer science)" data-language-autonym="English" data-language-local-name="enska" class="interlanguage-link-target"><span>English</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 – esperantó" lang="eo" hreflang="eo" data-title="Signoĉeno" data-language-autonym="Esperanto" data-language-local-name="esperantó" class="interlanguage-link-target"><span>Esperanto</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 – spænska" lang="es" hreflang="es" data-title="Cadena de caracteres" data-language-autonym="Español" data-language-local-name="spænska" class="interlanguage-link-target"><span>Español</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) – eistneska" lang="et" hreflang="et" data-title="Sõne (andmetüüp)" data-language-autonym="Eesti" data-language-local-name="eistneska" class="interlanguage-link-target"><span>Eesti</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="رشته (علوم رایانه) – persneska" lang="fa" hreflang="fa" data-title="رشته (علوم رایانه)" data-language-autonym="فارسی" data-language-local-name="persneska" class="interlanguage-link-target"><span>فارسی</span></a></li><li class="interlanguage-link interwiki-fi mw-list-item"><a href="https://fi.wikipedia.org/wiki/Merkkijono" title="Merkkijono – finnska" lang="fi" hreflang="fi" data-title="Merkkijono" data-language-autonym="Suomi" data-language-local-name="finnska" class="interlanguage-link-target"><span>Suomi</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 – franska" lang="fr" hreflang="fr" data-title="Chaîne de caractères" data-language-autonym="Français" data-language-local-name="franska" class="interlanguage-link-target"><span>Français</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="מחרוזת (מדעי המחשב) – hebreska" lang="he" hreflang="he" data-title="מחרוזת (מדעי המחשב)" data-language-autonym="עברית" data-language-local-name="hebreska" 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="स्ट्रिंग (संगणन) – hindí" lang="hi" hreflang="hi" data-title="स्ट्रिंग (संगणन)" data-language-autonym="हिन्दी" data-language-local-name="hindí" 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 – ungverska" lang="hu" hreflang="hu" data-title="String" data-language-autonym="Magyar" data-language-local-name="ungverska" class="interlanguage-link-target"><span>Magyar</span></a></li><li class="interlanguage-link interwiki-id mw-list-item"><a href="https://id.wikipedia.org/wiki/Untaian" title="Untaian – indónesíska" lang="id" hreflang="id" data-title="Untaian" data-language-autonym="Bahasa Indonesia" data-language-local-name="indónesíska" class="interlanguage-link-target"><span>Bahasa Indonesia</span></a></li><li class="interlanguage-link interwiki-io mw-list-item"><a href="https://io.wikipedia.org/wiki/Signokateno" title="Signokateno – ídó" lang="io" hreflang="io" data-title="Signokateno" data-language-autonym="Ido" data-language-local-name="ídó" class="interlanguage-link-target"><span>Ido</span></a></li><li class="interlanguage-link interwiki-it mw-list-item"><a href="https://it.wikipedia.org/wiki/Stringa_(informatica)" title="Stringa (informatica) – ítalska" lang="it" hreflang="it" data-title="Stringa (informatica)" data-language-autonym="Italiano" data-language-local-name="ítalska" class="interlanguage-link-target"><span>Italiano</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="文字列 – japanska" lang="ja" hreflang="ja" data-title="文字列" data-language-autonym="日本語" data-language-local-name="japanska" class="interlanguage-link-target"><span>日本語</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="문자열 – kóreska" lang="ko" hreflang="ko" data-title="문자열" data-language-autonym="한국어" data-language-local-name="kóreska" class="interlanguage-link-target"><span>한국어</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="Низа (информатика) – makedónska" lang="mk" hreflang="mk" data-title="Низа (информатика)" data-language-autonym="Македонски" data-language-local-name="makedónska" 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="അക്ഷരശൃംഖല (കമ്പ്യൂട്ടർ ശാസ്ത്രം) – malajalam" lang="ml" hreflang="ml" data-title="അക്ഷരശൃംഖല (കമ്പ്യൂട്ടർ ശാസ്ത്രം)" data-language-autonym="മലയാളം" data-language-local-name="malajalam" 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 – malaíska" lang="ms" hreflang="ms" data-title="Rentetan" data-language-autonym="Bahasa Melayu" data-language-local-name="malaíska" 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 – hollenska" lang="nl" hreflang="nl" data-title="Tekenreeks" data-language-autonym="Nederlands" data-language-local-name="hollenska" class="interlanguage-link-target"><span>Nederlands</span></a></li><li class="interlanguage-link interwiki-no mw-list-item"><a href="https://no.wikipedia.org/wiki/Streng_(informatikk)" title="Streng (informatikk) – norskt bókmál" lang="nb" hreflang="nb" data-title="Streng (informatikk)" data-language-autonym="Norsk bokmål" data-language-local-name="norskt bókmá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 – pólska" lang="pl" hreflang="pl" data-title="Tekstowy typ danych" data-language-autonym="Polski" data-language-local-name="pólska" 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 – portúgalska" lang="pt" hreflang="pt" data-title="Cadeia de caracteres" data-language-autonym="Português" data-language-local-name="portúgalska" 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="Строковый тип – rússneska" lang="ru" hreflang="ru" data-title="Строковый тип" data-language-autonym="Русский" data-language-local-name="rússneska" 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="Ниска – serbneska" lang="sr" hreflang="sr" data-title="Ниска" data-language-autonym="Српски / srpski" data-language-local-name="serbneska" class="interlanguage-link-target"><span>Српски / srpski</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) – sænska" lang="sv" hreflang="sv" data-title="Sträng (data)" data-language-autonym="Svenska" data-language-local-name="sænska" class="interlanguage-link-target"><span>Svenska</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="สายอักขระ – taílenska" lang="th" hreflang="th" data-title="สายอักขระ" data-language-autonym="ไทย" data-language-local-name="taílenska" class="interlanguage-link-target"><span>ไทย</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-tr mw-list-item"><a href="https://tr.wikipedia.org/wiki/Dize_(bilgisayar_bilimi)" title="Dize (bilgisayar bilimi) – tyrkneska" lang="tr" hreflang="tr" data-title="Dize (bilgisayar bilimi)" data-language-autonym="Türkçe" data-language-local-name="tyrkneska" 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="Рядок (програмування) – úkraínska" lang="uk" hreflang="uk" data-title="Рядок (програмування)" data-language-autonym="Українська" data-language-local-name="úkraínska" 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-kínverska" lang="wuu" hreflang="wuu" data-title="字符串" data-language-autonym="吴语" data-language-local-name="wu-kínverska" 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="字符串 – kínverska" lang="zh" hreflang="zh" data-title="字符串" data-language-autonym="中文" data-language-local-name="kínverska" 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-zh-yue mw-list-item"><a href="https://zh-yue.wikipedia.org/wiki/%E5%AD%97%E4%B8%B2" title="字串 – kantónska" lang="yue" hreflang="yue" data-title="字串" data-language-autonym="粵語" data-language-local-name="kantónska" 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="Breyta tungumálatenglum" class="wbc-editpage">Breyta tenglum</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="Nafnrými"> <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/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)" title="Sýna efnissíðuna [c]" accesskey="c"><span>Síða</span></a></li><li id="ca-talk" class="vector-tab-noicon mw-list-item"><a href="/wiki/Spjall:Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)" rel="discussion" title="Spallsíða þessarar síðu [t]" accesskey="t"><span>Spjall</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="Breyta tungumálaafbrigði" > <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">íslenska</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="Sýn"> <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/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)"><span>Lesa</span></a></li><li id="ca-ve-edit" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;veaction=edit" title="Breyta þessari síðu [v]" accesskey="v"><span>Breyta</span></a></li><li id="ca-edit" class="collapsible vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=edit" title="Breyta frumkóða síðunnar [e]" accesskey="e"><span>Breyta frumkóða</span></a></li><li id="ca-history" class="vector-tab-noicon mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=history" title="Eldri útgáfur af síðunni. [h]" accesskey="h"><span>Breytingaskrá</span></a></li> </ul> </div> </div> </nav> <nav class="vector-page-tools-landmark" aria-label="Síðuverkfæri"> <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="Verkfæri" > <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">Verkfæri</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">Verkfæri</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-page-tools.pin">færa í hliðarstiku</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-page-tools.unpin">fela</button> </div> <div id="p-cactions" class="vector-menu mw-portlet mw-portlet-cactions emptyPortlet vector-has-collapsible-items" title="Fleiri valkostir" > <div class="vector-menu-heading"> Aðgerðir </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/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)"><span>Lesa</span></a></li><li id="ca-more-ve-edit" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;veaction=edit" title="Breyta þessari síðu [v]" accesskey="v"><span>Breyta</span></a></li><li id="ca-more-edit" class="collapsible vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=edit" title="Breyta frumkóða síðunnar [e]" accesskey="e"><span>Breyta frumkóða</span></a></li><li id="ca-more-history" class="vector-more-collapsible-item mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=history"><span>Breytingaskrá</span></a></li> </ul> </div> </div> <div id="p-tb" class="vector-menu mw-portlet mw-portlet-tb" > <div class="vector-menu-heading"> Almennt </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="t-whatlinkshere" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:S%C3%AD%C3%B0ur_sem_tengjast_hinga%C3%B0/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)" title="Listi yfir síður sem tengjast í þessa [j]" accesskey="j"><span>Hvað tengist hingað</span></a></li><li id="t-recentchangeslinked" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:N%C3%BDlegar_breytingar_tengdar/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)" rel="nofollow" title="Nýlegar breytingar á ítengdum síðum [k]" accesskey="k"><span>Skyldar breytingar</span></a></li><li id="t-upload" class="mw-list-item"><a href="/wiki/Wikipedia:Hlaða_inn_skrá" title="Hlaða inn skrám [u]" accesskey="u"><span>Hlaða inn skrá</span></a></li><li id="t-specialpages" class="mw-list-item"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:Kerfiss%C3%AD%C3%B0ur" title="Listi yfir kerfissíður [q]" accesskey="q"><span>Kerfissíður</span></a></li><li id="t-permalink" class="mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;oldid=1377627" title="Varanlegur tengill í þessa útgáfu síðunnar"><span>Varanlegur tengill</span></a></li><li id="t-info" class="mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=info" title="Frekari upplýsingar um þessa síðu"><span>Síðuupplýsingar</span></a></li><li id="t-cite" class="mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:CiteThisPage&amp;page=Strengur_%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29&amp;id=1377627&amp;wpFormIdentifier=titleform" title="Upplýsingar um hvernig á að vitna í þessa síðu"><span>Vitna í þessa síðu</span></a></li><li id="t-urlshortener" class="mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:UrlQ%C4%B1sald%C4%B1c%C4%B1s%C4%B1&amp;url=https%3A%2F%2Fis.wikipedia.org%2Fwiki%2FStrengur_%28t%25C3%25B6lvunarfr%25C3%25A6%25C3%25B0i%29"><span>Fá styttan tengil</span></a></li><li id="t-urlshortener-qrcode" class="mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:QrKodu&amp;url=https%3A%2F%2Fis.wikipedia.org%2Fwiki%2FStrengur_%28t%25C3%25B6lvunarfr%25C3%25A6%25C3%25B0i%29"><span>Niðurhlaða QR-kóða</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"> Prenta/flytja út </div> <div class="vector-menu-content"> <ul class="vector-menu-content-list"> <li id="coll-create_a_book" class="mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:Book&amp;bookcmd=book_creator&amp;referer=Strengur+%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29"><span>Búa til bók</span></a></li><li id="coll-download-as-rl" class="mw-list-item"><a href="/w/index.php?title=Kerfiss%C3%AD%C3%B0a:DownloadAsPdf&amp;page=Strengur_%28t%C3%B6lvunarfr%C3%A6%C3%B0i%29&amp;action=show-download-screen"><span>Sækja sem PDF</span></a></li><li id="t-print" class="mw-list-item"><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;printable=yes" title="Prentanleg útgáfa af þessari síðu [p]" accesskey="p"><span>Prentvæn útgáfa</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"> Í öðrum verkefnum </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="Tengill á tengdan hlut í gagnagrunni [g]" accesskey="g"><span>Wikidata hlutur</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="Síðuverkfæri"> <div id="vector-page-tools-pinned-container" class="vector-pinned-container"> </div> </nav> <nav class="vector-appearance-landmark" aria-label="Útlit"> <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">Útlit</div> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-pin-button" data-event-name="pinnable-header.vector-appearance.pin">færa í hliðarstiku</button> <button class="vector-pinnable-header-toggle-button vector-pinnable-header-unpin-button" data-event-name="pinnable-header.vector-appearance.unpin">fela</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">Úr Wikipediu, frjálsa alfræðiritinu</div> </div> <div id="contentSub"><div id="mw-content-subtitle"></div></div> <div id="mw-content-text" class="mw-body-content"><div class="mw-content-ltr mw-parser-output" lang="is" dir="ltr"><p><b>Strengur</b> er <a href="/wiki/Gagnager%C3%B0" title="Gagnagerð">gagnagerð</a> í flestum <a href="/wiki/Forritunarm%C3%A1l" title="Forritunarmál">forritunarmálum</a> notað til að vinna með texta. Strengir bæði í forritunarmálum og <a href="/wiki/St%C3%A6r%C3%B0fr%C3%A6%C3%B0i" title="Stærðfræði">stærðfræði</a> eru notaðir til þess að halda utan um raðir tákna úr fyrirfram ákveðnum <a href="/wiki/Mengi" title="Mengi">mengjum</a>. Þessi mengi eru endanleg og kallast stafróf. Stafrófin geta verið mismunandi milli forritunarmála en oftast er um að ræða sammengi tölustafa, bókstafa og tákna. Strengir eru óbreytanlegir en forritunarmál bjóða gjarnan upp á leiðir til að meðhöndla strengi á ýmsa vegu. </p> <meta property="mw:PageProp/toc" /> <div class="mw-heading mw-heading2"><h2 id="Dæmi_um_gilda_strengi_í_Java"><span id="D.C3.A6mi_um_gilda_strengi_.C3.AD_Java"></span>Dæmi um gilda strengi í Java</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;veaction=edit&amp;section=1" title="Breyti hluta: Dæmi um gilda strengi í Java" class="mw-editsection-visualeditor"><span>breyta</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=edit&amp;section=1" title="Edit section&#039;s source code: Dæmi um gilda strengi í Java"><span>breyta frumkóða</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li>"123456"</li> <li>"halló"</li> <li>"halló123"</li> <li>"Halló heimur"</li> <li>"10,000 fyrir 100%"</li></ul> <div class="mw-heading mw-heading2"><h2 id="Dæmi_úr_Java-kóða"><span id="D.C3.A6mi_.C3.BAr_Java-k.C3.B3.C3.B0a"></span>Dæmi úr Java-kóða</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;veaction=edit&amp;section=2" title="Breyti hluta: Dæmi úr Java-kóða" class="mw-editsection-visualeditor"><span>breyta</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=edit&amp;section=2" title="Edit section&#039;s source code: Dæmi úr Java-kóða"><span>breyta frumkóða</span></a><span class="mw-editsection-bracket">]</span></span></div> <p>Nýr strengur búinn til: </p> <pre> String str = "abc"; </pre> <p>Má líka gera það svona: </p> <pre> char data[] = {'a', 'b', 'c'}; String str = new String(data); </pre> <p>Dæmi um hvernig má meðhöndla streng: </p> <pre> System.out.println("abc"); String cde = "cde"; System.out.println("abc" + cde); String c = "abc".substring(2,3); String d = cde.substring(1, 2); </pre> <div class="mw-heading mw-heading2"><h2 id="Tengt_efni">Tengt efni</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;veaction=edit&amp;section=3" title="Breyti hluta: Tengt efni" class="mw-editsection-visualeditor"><span>breyta</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=edit&amp;section=3" title="Edit section&#039;s source code: Tengt efni"><span>breyta frumkóða</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li><a href="/wiki/T%C3%B3mastrengur" title="Tómastrengur">Tómastrengur</a></li></ul> <div class="mw-heading mw-heading2"><h2 id="Heimildir">Heimildir</h2><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;veaction=edit&amp;section=4" title="Breyti hluta: Heimildir" class="mw-editsection-visualeditor"><span>breyta</span></a><span class="mw-editsection-divider"> | </span><a href="/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;action=edit&amp;section=4" title="Edit section&#039;s source code: Heimildir"><span>breyta frumkóða</span></a><span class="mw-editsection-bracket">]</span></span></div> <ul><li>Fyrirmynd greinarinnar var „<i><a href="https://en.wikipedia.org/wiki/String" class="extiw" title="en:String">String</a></i>“ á <a href="/wiki/Enska" title="Enska">ensku</a> útgáfu <a href="/wiki/Wikipedia" title="Wikipedia">Wikipedia</a>. Sótt 13. mars 2007.</li></ul> <!-- NewPP limit report Parsed by mw‐web.eqiad.main‐78b5c4f5c8‐97pt2 Cached time: 20241210011720 Cache expiry: 2592000 Reduced expiry: false Complications: [show‐toc] CPU time usage: 0.008 seconds Real time usage: 0.013 seconds Preprocessor visited node count: 39/1000000 Post‐expand include size: 176/2097152 bytes Template argument size: 26/2097152 bytes Highest expansion depth: 5/100 Expensive parser function count: 0/500 Unstrip recursion depth: 0/20 Unstrip post‐expand size: 0/5000000 bytes Number of Wikibase entities loaded: 0/400 --> <!-- Transclusion expansion time report (%,ms,calls,template) 100.00% 3.703 1 Snið:Wpheimild 100.00% 3.703 1 -total --> <!-- Saved in parser cache with key iswiki:pcache:39175:|#|:idhash:canonical and timestamp 20241210011720 and revision id 1377627. 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?useformat=desktop&amp;type=1x1&amp;usesul3=0" alt="" width="1" height="1" style="border: none; position: absolute;"></noscript> <div class="printfooter" data-nosnippet="">Sótt frá „<a dir="ltr" href="https://is.wikipedia.org/w/index.php?title=Strengur_(tölvunarfræði)&amp;oldid=1377627">https://is.wikipedia.org/w/index.php?title=Strengur_(tölvunarfræði)&amp;oldid=1377627</a>“</div></div> <div id="catlinks" class="catlinks" data-mw="interface"><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="/wiki/Kerfiss%C3%AD%C3%B0a:Flokkar" title="Kerfissíða:Flokkar">Flokkur</a>: <ul><li><a href="/wiki/Flokkur:Gagnager%C3%B0ir" title="Flokkur:Gagnagerðir">Gagnagerðir</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"> Þessari síðu var síðast breytt 8. mars 2013, klukkan 18:33.</li> <li id="footer-info-copyright">Textinn er gefinn út samkvæmt <a href="/wiki/Wikipedia:H%C3%B6fundar%C3%A9ttur" title="Wikipedia:Höfundaréttur">Creative Commons Tilvísun-DeilaEins leyfi</a>. Sjá nánar í <a class="external text" href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Terms_of_Use">notkunarskilmálum</a>.</li> </ul> <ul id="footer-places"> <li id="footer-places-privacy"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Privacy_policy">Meðferð persónuupplýsinga</a></li> <li id="footer-places-about"><a href="/wiki/Wikipedia:Um_verkefni%C3%B0">Um Wikipediu</a></li> <li id="footer-places-disclaimers"><a href="/wiki/Wikipedia:Almennur_fyrirvari">Fyrirvarar</a></li> <li id="footer-places-wm-codeofconduct"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Universal_Code_of_Conduct">Siðareglur</a></li> <li id="footer-places-developers"><a href="https://developer.wikimedia.org">Forritarar</a></li> <li id="footer-places-statslink"><a href="https://stats.wikimedia.org/#/is.wikipedia.org">Tölfræði</a></li> <li id="footer-places-cookiestatement"><a href="https://foundation.wikimedia.org/wiki/Special:MyLanguage/Policy:Cookie_statement">Yfirlýsing vegna vefkakna</a></li> <li id="footer-places-mobileview"><a href="//is.m.wikipedia.org/w/index.php?title=Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)&amp;mobileaction=toggle_view_mobile" class="noprint stopMobileRedirectToggle">Farsímaútgáfa</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-55db797859-ct22g","wgBackendResponseTime":145,"wgPageParseReport":{"limitreport":{"cputime":"0.008","walltime":"0.013","ppvisitednodes":{"value":39,"limit":1000000},"postexpandincludesize":{"value":176,"limit":2097152},"templateargumentsize":{"value":26,"limit":2097152},"expansiondepth":{"value":5,"limit":100},"expensivefunctioncount":{"value":0,"limit":500},"unstrip-depth":{"value":0,"limit":20},"unstrip-size":{"value":0,"limit":5000000},"entityaccesscount":{"value":0,"limit":400},"timingprofile":["100.00% 3.703 1 Snið:Wpheimild","100.00% 3.703 1 -total"]},"cachereport":{"origin":"mw-web.eqiad.main-78b5c4f5c8-97pt2","timestamp":"20241210011720","ttl":2592000,"transientcontent":false}}});});</script> <script type="application/ld+json">{"@context":"https:\/\/schema.org","@type":"Article","name":"Strengur (t\u00f6lvunarfr\u00e6\u00f0i)","url":"https:\/\/is.wikipedia.org\/wiki\/Strengur_(t%C3%B6lvunarfr%C3%A6%C3%B0i)","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":"2007-03-13T23:31:29Z","dateModified":"2013-03-08T18:33:28Z"}</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10