World Library  
Flag as Inappropriate
Email this Article

Concatenate

Article Id: WHEBN0000949833
Reproduction Date:

Title: Concatenate  
Author: World Heritage Encyclopedia
Language: English
Subject: Radix sort, Organizationally unique identifier, Multiple encryption
Collection:
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Concatenate

This article is about the string operation of computer programming. For other uses, see Concatenation (disambiguation).
For concatenation of general lists, see Append.

Template:ProgLangCompare In formal language theory and computer programming, string concatenation is the operation of joining two character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball".

In many programming languages, string concatenation is a binary infix operator. The "+" operator is often overloaded to denote concatenation for string arguments: "Hello, " + "World"; has the value "Hello, World".

Concatenation of sets of strings

In formal language theory and pattern matching (including regular expressions), 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.

There is typically no explicit concatenation operator, simply juxtaposition (as with multiplication).

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 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.

References

  • John E. Hopcroft and Jeffrey D. Ullman, Introduction to Automata Theory, Languages and Computation, Addison-Wesley Publishing, Reading Massachusetts, 1979. ISBN 0-201-02988-X.
  • JOHN CORCORAN (logician), WILLIAM FRANK, and MICHAEL MALONEY, String theory, Journal of Symbolic Logic, vol. 39 (1974) pp. 625– 637
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 


Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.