Concatenation
Encyclopedia
In computer programming
Computer programming
Computer programming is the process of designing, writing, testing, debugging, and maintaining the source code of computer programs. This source code is written in one or more programming languages. The purpose of programming is to create a program that performs specific operations or exhibits a...

, 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 language
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....

s, string concatenation is a binary
Binary operation
In mathematics, a binary operation is a calculation involving two operands, in other words, an operation whose arity is two. Examples include the familiar arithmetic operations of addition, subtraction, multiplication and division....

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

Concatenation of sets of strings

In computer science
Computer science
Computer science or computing science is the study of the theoretical foundations of information and computation and of practical techniques for their implementation and application in computer systems...

, in particular in the theory of computation
Theory of computation
In theoretical computer science, the theory of computation is the branch that deals with whether and how efficiently problems can be solved on a model of computation, using an algorithm...

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

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
Speaking clock
A speaking clock service is a recorded or simulated human voice service, usually accessed by telephone, that gives the correct time. The first telephone speaking clock service was introduced in France, in association with the Paris Observatory on 14 February 1933.The format of the service is...

, 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
Moviefone
Moviefone is an American-based movie listing and information service. Moviegoers can obtain local showtimes, theatre information, film reviews, or advance tickets...

, 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
Relational database
A relational database is a database that conforms to relational model theory. The software used in a relational database is called a relational database management system . Colloquial use of the term "relational database" may refer to the RDBMS software, or the relational database itself...

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.
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK