Concatenation

Concatenation
Programming language comparisons
General comparison
Basic syntax
Basic instructions
Arrays
Associative arrays
String operations
String functions
List comprehension
Object-oriented programming
Object-oriented constructors
Database access
Database RDBMS

Evaluation strategy
List of "hello world" programs

ALGOL 58's influence on ALGOL 60
ALGOL 60: Comparisons with other languages
Comparison of ALGOL 68 and C++
ALGOL 68: Comparisons with other languages
Compatibility of C and C++
Comparison of Pascal and Borland Delphi
Comparison of Object Pascal and C
Comparison of Pascal and C
Comparison of Java and C++
Comparison of C# and Java
Comparison of C# and Visual Basic .NET
This box: view · talk · edit

In computer programming, string concatenation is the operation of joining two character strings end-to-end. For example, the strings "snow" and "ball" may be concatenated to give "snowball". In many programming languages, string concatenation is a binary infix operator.

For example, the following expression uses the "+" symbol as the concatenation operator to join 2 strings: "Hello, " + "World";, and has the value "Hello, World".

Contents

Concatenation of sets of strings

In computer science, in particular in the theory of computation, the concatenation operation on strings is generalized 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.

In this definition, the string vw is the ordinary concatenation of strings v and w as defined in the introductory section. In this context, sets of strings are often referred to as formal languages. Notice that we do not use an explicit operator symbol for representing the concatenation.

Applications

Audio/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"
  • "Two"
  • "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 computerized 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 subunit number, city name, state/province name, postal code, and country name, e.g., "123 Fake St Apt 4, Boulder, CO 80302, USA", which combines 7 fields. However, the customers data table should not use one field to store that concatenated string; rather, the concatenation of the 7 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.

References

  • John E. Hopcroft and Jeffrey D. Ullman, Introduction to Automata Theory, Languages and Computation, Addison-Wesley Publishing, Reading Massachusetts, 1979. ISBN 0-201-029880-X.

Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу
Synonyms:

Look at other dictionaries:

  • Concatenation — Concaténation Le terme concaténation (substantif féminin), du latin cum ( avec ) et catena ( chaîne, liaison ), désigne l action de mettre bout à bout au moins deux chaînes. Sommaire 1 Langages formels 1.1 Concaténation d ensembles de mots 1.2… …   Wikipédia en Français

  • concaténation — [ kɔ̃katenasjɔ̃ ] n. f. • v. 1500; lat. concatenatio, de catena « chaîne » ♦ Didact. Enchaînement (des causes et des effets, des termes d un syllogisme). Math. Loi de concaténation : loi associative transformant plusieurs suites ordonnées d un… …   Encyclopédie Universelle

  • Concatenation — Con*cat e*na tion ( n[=a] sh[u^]n), n. [L. concatenatio.] A series of links united; a series or order of things depending on each other, as if linked together; a chain, a succession. [1913 Webster] The stoics affirmed a fatal, unchangeable… …   The Collaborative International Dictionary of English

  • Concatenation — Concatenation, lat., Verkettung; concatenirter Schluß, Kettenschluß …   Herders Conversations-Lexikon

  • concatenation — index chain (series), conjunction, connection (fastening), joinder, sequence, succession B …   Law dictionary

  • concatenation — c.1600, from L.L. concatenationem (nom. concatenatio) a linking together, noun of action from concatenat , pp. stem of concatenare to link together, from com together (see COM (Cf. com )) + catenare, from catena a chain (see CHAIN ( …   Etymology dictionary

  • concatenation — articulation, integration (see under INTEGRATE vb) Analogous words: sequence, *succession, chain, train …   New Dictionary of Synonyms

  • concatenation — [n] connection, sequence chain, connecting, continuity, integration, interlocking, link, linking, nexus, series, succession, uniting; concepts 721,727 Ant. interruption …   New thesaurus

  • concatenation — [kən kat΄ n ā′shən, känkat΄ n ā shən] n. [LL concatenatio: see CONCATENATE] 1. a linking together or being linked together in a series 2. a series of things or events regarded as causally or dependently connected …   English World dictionary

  • Concaténation — Le terme concaténation (substantif féminin), du latin cum (« avec ») et catena (« chaîne, liaison »), désigne l action de mettre bout à bout au moins deux chaînes. Sommaire 1 Langages formels 1.1 Concaténation d ensembles de… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”