Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The History Behind the Definition of a 'String'

I have never thought about until recently, but I'm not sure why we call strings strings. I am a .NET programmer, but I believe the concept of strings exist in virtually every programming language.

Outside of programming, I don't believe 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 the nature associated to programming.

My guess 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?

like image 894
Rob P. Avatar asked May 18 '09 22:05

Rob P.


People also ask

Where does the term string come from?

Old English streng "line, cord, thread, string of a bow or harp," in plural "tackle, rigging; lineage, race," from Proto-Germanic *strangiz (source also of Old Norse strengr, Danish streng, Middle Dutch strenge, Dutch streng, Old High German strang, German Strang "rope, cord"), from *strang- "taut, stiff," from PIE ...

What is the concept of string?

A string is generally considered as a data type and is often implemented as an array data structure of bytes (or words) that stores a sequence of elements, typically characters, using some character encoding. String may also denote more general arrays or other sequence (or list) data types and structures.

What is the purpose of the word string?

A string is a data type used in programming, such as an integer and floating point unit, but is used to represent text rather than numbers. It is comprised of a set of characters that can also contain spaces and numbers.

What does the saying on a string mean?

Definition of have (someone) on a string informal. : to be able to make (someone) do anything one wants.


2 Answers

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.

like image 131
CloudyMusic Avatar answered Oct 08 '22 18:10

CloudyMusic


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.

like image 33
Paul Sonier Avatar answered Oct 08 '22 18:10

Paul Sonier