Concatenation

A spreadsheet's concatenate ("&") function is used to assemble a complex text string—in this example, XML code for an SVG "circle" element.

In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball". In certain formalizations of concatenation theory, also called string theory, string concatenation is a primitive notion.

Syntax

In many programming languages, string concatenation is a binary infix operator, and in some it is written without an operator. This is implemented in different ways:

  • Overloading the plus sign + Example from C#: "Hello, " + "World" has the value "Hello, World".
  • Dedicated operator, such as . in PHP, & in Visual Basic[1] and || in SQL.[2][3] This has the advantage over reusing + that it allows implicit type conversion to string.
  • string literal concatenation, which means that adjacent strings are concatenated without any operator. Example from C: "Hello, " "World" has the value "Hello, World".

Implementation

In programming, string concatenation generally occurs at run time, as string values are typically not known until run time. However, in the case of string literals, the values are known at compile time, and thus string concatenation can be done at compile time, either via string literal concatenation or via constant folding, a potential run-time optimization.

Concatenation of sets of strings

In formal language theory and pattern matching (including regular expressions), the concatenation operation on strings is generalised to an operation on sets of strings as follows:

For two sets of strings S1 and S2, the concatenation S1S2 consists of all strings of the form vw where v is a string from S1 and w is a string from S2, or formally S1S2 = { vw : vS1, wS2 }. Many authors also use concatenation of a string set and a single string, and vice versa, which are defined similarly by S1w = { vw : vS1 } and vS2 = { vw : wS2 }. In these definitions, the string vw is the ordinary concatenation of strings v and w as defined in the introductory section.

For example, if F = { a, b, c, d, e, f, g, h }, and R = { 1, 2, 3, 4, 5, 6, 7, 8 }, then FR denotes the set of all chess board coordinates in algebraic notation, while eR denotes the set of all coordinates of the kings' file.

In this context, sets of strings are often referred to as formal languages. The concatenation operator is usually expressed as simple juxtaposition (as with multiplication).

Algebraic properties

The strings over an alphabet, with the concatenation operation, form an associative algebraic structure with identity element the null string—a free monoid.

Sets of strings with concatenation and alternation form a semiring, with concatenation (*) distributing over alternation (+); 0 is the empty set and 1 the set consisting of just the null string.

Applications

Audio and telephony

In programming for telephony, concatenation is used to provide dynamic audio feedback to a user. For example, in a "time of day" speaking clock, concatenation is used to give the correct time by playing the appropriate recordings concatenated together. For example: "at the tone, the time will be", "eight", "thirty", "five", "and", "twenty", "five", "seconds".

The recordings themselves exist separately, but playing them one after the other provides a grammatically correct sentence to the listener.

This technique is also used in number change announcements, voice mail systems, or most telephony applications that provide dynamic feedback to the caller (e.g. moviefone, tellme, and others).

Programming for any kind of computerised public address system can also employ concatenation for dynamic public announcements (for example, flights in an airport). The system would archive recorded speech of numbers, routes or airlines, destinations, times, etc. and play them back in a specific sequence to produce a grammatically correct sentence that is announced throughout the facility.

Database theory

One of the principles of relational database design is that the fields of data tables should reflect a single characteristic of the table's subject, which means that they should not contain concatenated strings. When concatenation is desired in a report, it should be provided at the time of running the report. For example, to display the physical address of a certain customer, the data might include building number, street name, building sub-unit number, city name, state/province name, postal code, and country name, e.g., "123 Fake St Apt 4, Boulder, CO 80302, USA", which combines seven fields. However, the customers data table should not use one field to store that concatenated string; rather, the concatenation of the seven fields should happen upon running the report. The reason for such principles is that without them, the entry and updating of large volumes of data becomes error-prone and labor-intensive. Separately entering the city, state, ZIP code, and nation allows data-entry validation (such as detecting an invalid state abbreviation). Then those separate items can be used for sorting or indexing the records, such as all with "Boulder" as the city name.

Recreational mathematics

In recreational mathematics, many problems concern the properties of numbers under concatenation of their numerals in some base. Examples include home primes (primes obtained by repeatedly factoring the increasing concatenation of prime factors of a given number), Smarandache–Wellin numbers (the concatenations of the first prime numbers), and the Champernowne and Copeland–Erdős constants (the real numbers formed by the decimal representations of the positive integers and the prime numbers, respectively).

See also

References

Citations

  1. ^ "Concatenation Operators in Visual Basic". .NET Visual Basic guide Language features: Operators and expressions. Microsoft. 2015.
  2. ^ "SQL | Concatenation Operator". geeksforgeeks.org. 12 January 2018. Retrieved 11 August 2023.
  3. ^ "Concatenation Operator". Oracle Database Online Documentation, 10g Release 2 (10.2) / Administration: Database SQL Reference. Oracle.

Sources

Read other articles:

Вулиця ЗатишнаЧеркасиМісцевість ДахнівкаРайон Соснівський районНазва на честь далекого розташування від центральних вулицьКолишні назви Василевського, Маршала ВасилевськогоЗагальні відомостіПротяжність 390 мЗовнішні посиланняУ проєкті OpenStreetMap пошук у NominatimНа карті...

 

Islamic view of Moses This article covers the views on Moses specific to Islamic theology. For a general overview, see Moses. ProphetMusaموسىMosesKnown forSplitting the Red Sea and seeing IblisPredecessorShu'aybSuccessorHarunSpouseṢaffūrahRelativesYūkābid (mother)Asiya (adoptive mother)Miriam (sister)Hārūn (brother) Mūsā ibn ʿImrān (Arabic: موسى ابن عمران, lit. 'Moses, son of Amram')[1] is a prominent prophet and messenger of God and is the mo...

 

Fritz-Karsen-Schule Schulform Integrierte Sekundarschule Schulnummer 08K06 Gründung 1948 Adresse Onkel-Bräsig-Straße 76 / 78Backbergstraße 37Fulhamer Allee 30 Ort Berlin-Britz Land Berlin Staat Deutschland Koordinaten 52° 26′ 55″ N, 13° 26′ 38″ O52.4484913.443897Koordinaten: 52° 26′ 55″ N, 13° 26′ 38″ O Träger Land Berlin Schüler 1211 (2022/2023)[1] Lehrkräfte 136 + 29 Erzieher + 1 Päd. Mitarb. + 5...

1961 New York City mayoral election ← 1957 November 7, 1961 1965 →   Candidate Robert F. Wagner, Jr. Louis J. Lefkowitz Lawrence E. Gerosa Party Democratic Republican Citizens Alliance Liberal Popular vote 1,237,423 835,691 321,604 Percentage 51.0% 34.5% 13.3% Results by Borough   Wagner—50–60%   Wagner—40–50%   Lefkowitz—40–50% Mayor before election Robert F. Wagner, Jr. Democratic Elected Mayor Robert F. Wagner, Jr. D...

 

Henri-Achille Zo Retrato grabado de Henri-Achille Zo (anterior a 1904).Información personalNacimiento 2 de diciembre de 1873 Bayona (Francia) Fallecimiento 9 de septiembre de 1933 (59 años)Onesse-et-Laharie (Francia) Causa de muerte Accidente de tránsito Nacionalidad FrancesaFamiliaPadre Jean-Baptiste Achille Zo EducaciónEducado en Escuela Nacional Superior de Bellas Artes de París Alumno de Jean-Baptiste Achille ZoLéon Bonnat Información profesionalOcupación Pintor e ilustrador Disti...

 

Peter Mollner (* 1732 in Wien; † 30. August 1801 ebenda) war ein österreichischer Baumeister. Inhaltsverzeichnis 1 Leben 2 Werk 3 Der kaiserliche Steinbruch 4 Literatur 5 Weblinks 6 Einzelnachweise Leben Über Herkunft und Jugend Mollners ist nichts bekannt. Im Jahr 1766 heiratete er Theresia Dorn, mit der er sechs Kinder hatte. Im gleichen Jahr erhielt er auch die Baumeisterkonzession. Mollner war nicht nur bürgerlicher Stadtbaumeister, sondern nach 1777 als Nachfolger von Johann Ferdina...

У Вікіпедії є статті про інших людей із прізвищем Андреєва. Андреєва Ірина ВіталіївнаНародилася 3 серпня 1979(1979-08-03) (44 роки)Громадянство  УкраїнаДіяльність акторкаAlma mater Київський національний економічний університет імені Вадима Гетьмана і Київський національни...

 

A tradução deste artigo está abaixo da qualidade média aceitável. Talvez tenha sido feita por um computador ou alguém que não conhece bem o português ou a língua original. Caso queira colaborar com a Wikipédia, cine e melhore este verbete conforme o guia de tradução. (Março de 2021) Justice Smith Justice Smith Nome completo Justice Elio Smith Nascimento 9 de agosto de 1995 (28 anos)Anaheim, Califórnia, Nacionalidade norte-americano Ocupação Ator Atividade 2012-presen...

 

Ця стаття містить правописні, лексичні, граматичні, стилістичні або інші мовні помилки, які треба виправити. Ви можете допомогти вдосконалити цю статтю, погодивши її із чинними мовними стандартами. (серпень 2019) 1. Греко-вірменський папірус — словник V—VII століть 2. Стор

Lenin era una hongo (en ruso: Ленин — гриб) fue un bulo televisado altamente influyente hecho por el músico y reportero soviético Serguéi Kuriojin. Su primera y única emisión fue el 17 de mayo de 1991 en el canal Televisión de San Petersburgo.[1]​[2]​ Historia Una de las últimas fotografías de Lenin, tomada en Gorki posteriormente al 15 de mayo de 1923. El bulo tomó la forma de una entrevista en el programa televisivo Piatoe Koleso (La Quinta Rueda). En la entr...

 

Swimming Federation of IndiaSportAquatic sportsCategorySwimming, masters swimming, synchronized swimming, diving, high diving, and water poloJurisdictionNationalMembership30 State/UT associations[1]AbbreviationSFIFounded1948; 75 years ago (1948)AffiliationFINAAffiliation date1932[a]Regional affiliationAsia Swimming FederationHeadquarters11/A Vithalbhai Patel Colony, Navrangpura, Ahmedabad, Gujarat[2]PresidentR N JayprakashCEOVirendra NanavatiSecretary...

 

Договір Вебстера — ЕшбертонаТип міжнародний договірПідписано 9 серпня 1842Підписанти США і Canada under British ruled  Медіафайли у Вікісховищі Пам'ятна дошка у Вашингтоні Договір Вебстера — Ешбертона (англ. Webster–Ashburton Treaty) — договір між США і Великою Британією, який ула...

Raymond de Montmorency, eldest son of the third Viscount Frankfort de Montmorency Viscount Frankfort de Montmorency, of Galmoye in the County of Kilkenny, was a title in the Peerage of Ireland. It was created on 22 January 1816 for Lodge de Montmorency, 1st Baron Frankfort,[1] who had earlier represented Bandon Bridge, Dingle, Inistioge and Ennis in the Irish House of Commons. He had already been made Baron Frankfort, of Galmoye in the County of Kilkenny, on 31 July 1800, also in the ...

 

This article is part of a series aboutJohn F. Kennedy Military service in WWII Electoral history Why England Slept Profiles in Courage A Nation of Immigrants Family 35th President of the United States Presidency timeline Transition Inauguration Tenure Executive actions New Frontier Foreign policy Doctrine A Strategy of Peace Bay of Pigs Cuban Missile Crisis Civil Rights Address Partial Nuclear Test Ban Treaty Clean Air Peace Corps We choose to go to the Moon Space programs Mercury Gemini Apol...

 

2021 science-fiction novel by Andy Weir This article is about the 2021 novel. For projects named Hail Mary, see Hail Mary (disambiguation). Project Hail Mary AuthorAndy WeirAudio read byRay PorterCover artistWill StaehleCountryUnited StatesLanguageEnglishGenreScience fictionPublisherBallantine BooksPublication dateMay 4, 2021Media typePrint, ebook, audiobookPages496Awards2021 Dragon Award for Best Science Fiction NovelISBN978-0-593-39556-1 Project Hail Mary is a 2021 scien...

Artikel ini sebatang kara, artinya tidak ada artikel lain yang memiliki pranala balik ke halaman ini.Bantulah menambah pranala ke artikel ini dari artikel yang berhubungan atau coba peralatan pencari pranala.Tag ini diberikan pada Februari 2023. Pantai Kusamba adalah pantai yang terletak di Desa Kusamba, kecamatan Dawan, Kabupaten Klungkung. Kurang lebih 7 km ke arah timur kota Semarapura, Klungkung. Para nelayan dan petani garam di sini masih menggunakan cara-cara lama yang diajarkan da...

 

British campaign medal This article is about the campaign medal given by the United Kingdom. For similar subjects, see Crimea Medal (disambiguation). AwardCrimea MedalObverse and reverse of the medal.TypeCampaign medalAwarded forCampaign service.DescriptionSilver disc, 36mm diameter.Presented by United Kingdom of Great Britain and IrelandEligibilityBritish forces.Campaign(s)Crimean War.Clasps Alma Inkerman Balaklava Sebastopol Azoff Established15 December 1854Total275,000[1]Ribbo...

 

Questa voce o sezione sull'argomento Stati Uniti d'America non cita le fonti necessarie o quelle presenti sono insufficienti. Puoi migliorare questa voce aggiungendo citazioni da fonti attendibili secondo le linee guida sull'uso delle fonti. Segui i suggerimenti del progetto di riferimento. Vicepresidente degli Stati Uniti d'America /Presidente del Senato degli Stati Uniti d'America La Vicepresidente e Presidente del Senato degli Stati Uniti Kamala Harris Nome originaleVice President of ...

American entrepreneur & diplomat (born 1975) Ken HoweryUnited States Ambassador to SwedenIn officeNovember 7, 2019 – January 20, 2021PresidentDonald TrumpPreceded byAzita RajiSucceeded byErik Ramanathan Personal detailsBornKenneth Alan Howery (1975-11-04) November 4, 1975 (age 48)Alma materStanford University (BA)Known forCo-founder and CFO at PayPal; Co-founder and partner at Founders Fund Kenneth Alan Howery (/ˈhaʊəri/; born November 4, 1975) is an American entreprene...

 

Device that projects a transparent image This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Overhead projector – news · newspapers · books · scholar · JSTOR (February 2008) (Learn how and when to remove this template message) Overhead projector in operation during a classroom lesson An overhead projector (often...

 

Strategi Solo vs Squad di Free Fire: Cara Menang Mudah!