views:

378

answers:

7

I've never thought about until just now, but I'm not sure why we call 'strings', strings. I'm a .Net programmer, but I know the concept of strings exist in virtually every language.

Outside of programming, I don't think I've heard the word 'string' used to describe words or letters. A quick Google of, 'Define: string' yields a bunch of definitions that have nothing to do with the concept of letters, words, or anything of that nature.

My understanding of it, is that, back in the day, strings were really just arrays of characters of a particular length, often with a delimiting character at the end. But, I don't see a natural transition from 'character array' to 'string'.

Can someone offer up some insight to why we call 'strings' strings?

A: 

It's called a strings, because it's actually an array of char type elements.

That being said, they are "stringing together" (or is it strung together) via this array, which turns them into a "string".

WebDevHobo
+13  A: 

My assumption has always been that the programming term originated from the following definition of the word "string" (from Merriam-Webster):

(1): a series of things arranged in or as if in a line <a string of cars> <a string of names>

(2): a sequence of like items (as bits, characters, or words)

Since a string in programming is simply an ordered sequence of characters, referring to this as a "string of characters" (or simply "string") seems like the most probable origin.

rmz
+3  A: 

I suspect it's because string originally meant just a sequence of data values: "I'll just string these together" etc. These values didn't have to be characters. One very common use for this general concept happened to be a sequence of characters, and this took over as the general meaning of the word.

Jon Skeet
A: 

http://en.wikipedia.org/wiki/String_(computer_science)

great_llama
Does that wikipedia article talk about the history of the term string at all? If so, I missed it (not that I'm the one who downvoted you).
KeyserSoze
Not specifically, but it does state, "a string is an ordered sequence of symbols" (with illustrations) which is almost the same thing stated in the top voted answer, which also contains no history, just definitions and an assumption, which is probably correct.
Bratch
+7  A: 

From this reference:

The 1971 OED (p. 3097) quotes an 1891 Century Dictionary on a source in the Milwaukee Sentinel of 11 Jan. 1898 (section 3, p. 1) to the effect that this is a compositor's term. Printers would paste up the text that they had generated in a long strip of characters. (Presumably, they were paid by the foot, not by the word!) The quote says that it was not unusual for compositors to create more than 1500 (characters?) per hour.

McWafflestix
If this is accurate, then it sounds likely to be the answer. We take many such terms from the world of printing, e.g., "font" being the bowl from which individual pieces of lead type were pulled to fill in the "string". "Font" referred to its similarity to a baptismal font (fountain).
John Saunders
It's not like I have a 1971 copy of the OED to check, but the quote seems reasonable to me.
McWafflestix
John's right. This answer is more about the history than the definition, which is what was asked for.
Bratch
I don't think there was much influence from printing in early computing. Fonts and such came later with graphical displays and dot matrix printers.
starblue
+1  A: 

The word was originally used to differentiate between a set of values to which the particular order of elements doesn't matter (for instance, a set of random samples of measurements) and another that could only have its meaning preserved when the order is also preserved. Originally a string could be a set of any kind of values, but since in the post-mainframe era a string of characters is by far the most common kind, the fact that the values are characters became a "default".

Fabio Ceconello
+2  A: 

From searching through the ACM bibliography it seems the word string acquired its meaning in computer science during the 1960s. At the beginning a string is a general kind of sequence or list, e.g. A command language for handling strings of symbols from 1958.

This article explicitly mentions "character strings" in 1964.

Unfortunately I can't access the full texts, which are behind a toll booth.

starblue