国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

Table of Contents
What is the historical origin of the word "string" in computer science?
How is strings different from other data types in programming?
Why are strings immutable in some programming languages?
How are strings stored in memory?
What common operations can be performed on strings?
How to convert a string to another data type?
What is string interpolation?
What is the difference between a string and a character array?
What are string literals?
How to represent special characters in strings?
Home Backend Development PHP Tutorial Why Is a String Called a String?

Why Is a String Called a String?

Feb 09, 2025 pm 12:28 PM

Why Is a String Called a String?

Core points

  • The origin of the programming term "string" is believed to be related to the era of typography, when printers charged based on the length of the printed material (in feet). They string together printed materials and use the word "string" to represent the character sequence.
  • In papers published in the 1940s and 1950s, the earliest academic references to use "string" to express similar meanings to modern programming were found. These early usages refer to sequences of the same symbols or continuous strings of letters between punctuation marks or spaces.
  • The term "string" (string) we know today in programming seems to have been established in the 1960s and appears in various academic papers and resources. It is used to represent a set of characters with meaning and bring some cost, similar to its usage in the age of typography.
  • Although the term "string" (string) does not have an equivalent word in the real world (we will not call the text on the page "strings"), it has become a commonly understood term in computer science, Represents a popular data type. The authors believe that there may be no other term that is more suitable for this data type than this term.

This is the editorial for the July 25 edition of the SitePoint PHP newsletter.


Why is a string called a string? Have you ever thought about this question? Apart from programming, we have never used such a word in other contexts to represent a set of letters glued together, however—in programming, it is as common as the word “variable.” Why is this, where does it come from?

To figure it out, we must first solve some related terms. History class time!

Why Is a String Called a String?

Wordfont (font) comes from French font——the melted thing; casting. Given that the letters of the press are indeed made of metal and melted at the Lead Foundry, this makes sense.

Why Is a String Called a String?

The terms uppercase (uppercase) and lowercase (lowercase) refer to the literal part of the font box used for font transportation. Therefore, the printer (man) has a heavy font box that he carries with him or sets on a press, in which there are two "levels" - one uppercase letter box and one lowercase letter box. The capital letter box only contains — you guessed it right — capital letters, while the lowercase letter box only contains lowercase letters.

Why Is a String Called a String?

You will notice that there are more lowercase letters than uppercase letters. This is expected – a letter can only be used once on a page, after all, there are much more lowercase letters in written text than uppercase letters, as there were no Youtube comments and case locks at that time.

So what does all this have to do with strings?

Well, as printing becomes more mainstream, presses are starting to provide services to individuals, not just newspapers and publishers, who are said to decide to charge based on the length of the printed material (in feet). Of course, many are speculative, but if they string the printed materials produced together, they can easily estimate the cost and charge the customer. Therefore, we can conclude with fair certainty that they use the word string (string) to represent a sequence of characters in this case. July 26, 2017 Edit: As pointed out in the comments below, it does seem that there is an actual rope for bundling the character blocks together, as they are shipped to the press after assembly! A Twitter fan even sent me the following video demonstrating the process!

Nevertheless, what does this have to do with the field of programming? I mean, you can say a string about anything

anything What if we look at the academic community’s records of the first reference? In the 1944 "Recursive Enumerable Positive Integer Sets and Its Decision Problems", we mentioned something that might be roughly similar to modern definitions:

For the purpose of working, we introduce letter 6 and consider "strings" 1 and b, such as 11b1bb1.

Why Is a String Called a String?

In this paper, this term refers to a sequence of the same symbols, so it is a string of 1 or a string of b. This doesn't exactly fit our definition, but it's just the beginning.

Then, 14 years later, in 1958's "A Programming Language for Mechanical Translation", the word was used in this way, and only once:

Each continuation string between punctuation marks or spaces is looked up in the dictionary.

Okay, a little bit like our concept of strings, but it looks like he's just describing, um,

word

. Obviously, this doesn't apply – it's too general. However, for some reason, it seems to have become popular.

In 1958's "A Command Language for Handling Symbol Strings", the word

string
(String) is used exactly the same way we are today, although there is no

definition ??>For this.

We found another reference in the 1959 "COMIT System for Mechanical Translation":

If we want to replace D SIN(F) with COS(F) D (F), where F is not limited and can be any arbitrary component sequence, we use the symbol $ to represent this string.

Funny! This is the dollar sign we all know from PHP, it is actually a string sign in BASIC.

Also in 1959, we obtained a more direct definition in "Share 709 System: Machine Implementation of Symbol Programming":

Text is a linearly sorted bit string that represents other information needed during loading and listing.

In fact, it was through the April 1960 ALGOL that strings seem to take their modern abbreviation form "string" (before this, people said string of [something]). See the abstract of this paper.

Then, in May 1960, the Report on Algorithm Language ALGOL 60 mentioned it in a form that touches the core content.

Why Is a String Called a String?

Since then, it has spread as quickly as modern memes.

1963's METEOR: A LISP Interpreter for String Conversion uses a rather unspecific "[...] But the simple conversion of some linear lists (strings) is very good in this symbol Difficult to define."

The 1964 "On Declaration of the Arbitrary Encoding Alphabet" mentioned "character string".

Search ACM shows many other resources from the 1960s and beyond, all of which now use the term regularly, so the 1960s seem to be the catalyst for the evolution of this term and make it what it is today, slowly, through Its system needs. Interestingly, it ultimately represents a similar concept to the typography era—a set of characters with meaning and brings some cost (just this time in memory).

As a side note - consider all these papers from more than 60 years ago. Sixty years ago, they used perforated cards to solve computer science problems and wrote about them in their academic papers. And we are now 2017, with the 2017 JavaScript framework, arguing about who can have sex with whom in Drupal's community and trying to redefine the word Facade over and over again. When we argue about the rocket science of modern web-developed “things go into boxes, things come out of boxes”, those people shape the entire world by transforming the analog environment they are in to digital, by essentially cheating on a small squeezing of sand Remember the numbers.

Conclusion

So now we know—or at least think we know—string (string) comes from. Computer science has always been a dark space full of mystery and slow evolution, just as we now know that the human eye has half-stage and half-eye in its past, and terms in computer science have also transcended and evolved around its original meaning until they gave What we have today. The same concept of the same name was born in various places at the same time in the 1960s until it evolved into a unified term that we all understood and used, and most importantly, we all agreed.

When you think about it carefully, can we use a better word? While strings (strings) almost feel unnatural due to a complete disconnect from similar terms in the "real world" (we won't call the text on the page "strings"), I can't think of anything more suitable for this popular data Type of terms. Can you? tell me.

FAQ for Strings in Computer Programming

What is the historical origin of the word "string" in computer science?

The word "string" in computer science is believed to originate from the phrase "character string". It was first used in programming when data was often represented as a sequence or "string" of alphanumeric characters. This term is used to describe the data types as character sequences in programming languages, and it has been used to this day.

How is strings different from other data types in programming?

Stands are sequences of characters that can include letters, numbers, and special characters. Unlike other data types such as integers or booleans (representing numerical or true/false values, respectively), strings are used to represent and manipulate text. They are basic data types in almost all programming languages, and they come with a variety of built-in methods for operation and analysis.

Why are strings immutable in some programming languages?

In some programming languages ??such as Java and Python, strings are immutable. This means that once a string is created, it cannot be changed. This design choice is mainly for efficiency and safety reasons. Since strings are often used in large quantities in programs, making them immutable can enable the system to optimize memory usage and processing speed. It also prevents potential security risks associated with mutable strings.

How are strings stored in memory?

Stands are usually stored in memory, as a character sequence, each character takes up a certain number of bytes, depending on the character encoding used. For example, in ASCII encoding, each character occupies one byte of memory, while in Unicode encoding, a character can occupy two or more bytes. The end of a string is usually marked with special empty characters.

What common operations can be performed on strings?

Many operations can be performed on strings, including concatenation (concatenation of two strings together), substring extraction (get part of a string), string comparison (checking whether two strings are equal), and characters String search (find a specific character or substring in a string). These operations are usually provided as built-in methods in programming languages.

How to convert a string to another data type?

Most programming languages ??provide functions or methods to convert strings to other data types. For example, in Python, you can use the int() function to convert a numeric string to an integer, or use the float() function to convert it to a floating point number. However, if the string does not represent a valid number, these conversions will fail.

What is string interpolation?

String interpolation is a programming technique in which variables or expressions are inserted directly into strings. This is often used to format strings in a more readable and convenient way. The syntax of string interpolation varies by programming language.

What is the difference between a string and a character array?

Strings are sequences of characters, and character arrays are arrays where each element is a character. In some programming languages ??such as C, strings are represented as characters ending with null characters. However, in many high-level languages, strings are a separate data type with their own methods and properties.

What are string literals?

Stand literals are strings written directly to the program source code. It is usually enclosed in quotes, and whether it is single or double quotes depends on the programming language. String literals are treated as constant values, and in some languages, they are immutable.

How to represent special characters in strings?

Special characters in strings, such as line breaks, tabs, or quote characters, are usually represented by escape sequences. An escape sequence is a backslash () followed by a character or character sequence. The exact syntax and available escape sequences vary by programming language.

The above is the detailed content of Why Is a String Called a String?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do I implement authentication and authorization in PHP? How do I implement authentication and authorization in PHP? Jun 20, 2025 am 01:03 AM

TosecurelyhandleauthenticationandauthorizationinPHP,followthesesteps:1.Alwayshashpasswordswithpassword_hash()andverifyusingpassword_verify(),usepreparedstatementstopreventSQLinjection,andstoreuserdatain$_SESSIONafterlogin.2.Implementrole-basedaccessc

How can you handle file uploads securely in PHP? How can you handle file uploads securely in PHP? Jun 19, 2025 am 01:05 AM

To safely handle file uploads in PHP, the core is to verify file types, rename files, and restrict permissions. 1. Use finfo_file() to check the real MIME type, and only specific types such as image/jpeg are allowed; 2. Use uniqid() to generate random file names and store them in non-Web root directory; 3. Limit file size through php.ini and HTML forms, and set directory permissions to 0755; 4. Use ClamAV to scan malware to enhance security. These steps effectively prevent security vulnerabilities and ensure that the file upload process is safe and reliable.

What are the differences between == (loose comparison) and === (strict comparison) in PHP? What are the differences between == (loose comparison) and === (strict comparison) in PHP? Jun 19, 2025 am 01:07 AM

In PHP, the main difference between == and == is the strictness of type checking. ==Type conversion will be performed before comparison, for example, 5=="5" returns true, and ===Request that the value and type are the same before true will be returned, for example, 5==="5" returns false. In usage scenarios, === is more secure and should be used first, and == is only used when type conversion is required.

How do I perform arithmetic operations in PHP ( , -, *, /, %)? How do I perform arithmetic operations in PHP ( , -, *, /, %)? Jun 19, 2025 pm 05:13 PM

The methods of using basic mathematical operations in PHP are as follows: 1. Addition signs support integers and floating-point numbers, and can also be used for variables. String numbers will be automatically converted but not recommended to dependencies; 2. Subtraction signs use - signs, variables are the same, and type conversion is also applicable; 3. Multiplication signs use * signs, which are suitable for numbers and similar strings; 4. Division uses / signs, which need to avoid dividing by zero, and note that the result may be floating-point numbers; 5. Taking the modulus signs can be used to judge odd and even numbers, and when processing negative numbers, the remainder signs are consistent with the dividend. The key to using these operators correctly is to ensure that the data types are clear and the boundary situation is handled well.

How can you interact with NoSQL databases (e.g., MongoDB, Redis) from PHP? How can you interact with NoSQL databases (e.g., MongoDB, Redis) from PHP? Jun 19, 2025 am 01:07 AM

Yes, PHP can interact with NoSQL databases like MongoDB and Redis through specific extensions or libraries. First, use the MongoDBPHP driver (installed through PECL or Composer) to create client instances and operate databases and collections, supporting insertion, query, aggregation and other operations; second, use the Predis library or phpredis extension to connect to Redis, perform key-value settings and acquisitions, and recommend phpredis for high-performance scenarios, while Predis is convenient for rapid deployment; both are suitable for production environments and are well-documented.

How do I stay up-to-date with the latest PHP developments and best practices? How do I stay up-to-date with the latest PHP developments and best practices? Jun 23, 2025 am 12:56 AM

TostaycurrentwithPHPdevelopmentsandbestpractices,followkeynewssourceslikePHP.netandPHPWeekly,engagewithcommunitiesonforumsandconferences,keeptoolingupdatedandgraduallyadoptnewfeatures,andreadorcontributetoopensourceprojects.First,followreliablesource

What is PHP, and why is it used for web development? What is PHP, and why is it used for web development? Jun 23, 2025 am 12:55 AM

PHPbecamepopularforwebdevelopmentduetoitseaseoflearning,seamlessintegrationwithHTML,widespreadhostingsupport,andalargeecosystemincludingframeworkslikeLaravelandCMSplatformslikeWordPress.Itexcelsinhandlingformsubmissions,managingusersessions,interacti

How to set PHP time zone? How to set PHP time zone? Jun 25, 2025 am 01:00 AM

TosettherighttimezoneinPHP,usedate_default_timezone_set()functionatthestartofyourscriptwithavalididentifiersuchas'America/New_York'.1.Usedate_default_timezone_set()beforeanydate/timefunctions.2.Alternatively,configurethephp.inifilebysettingdate.timez

See all articles