Fall 2024 - P3
3.4 Strings Introduction
Introduction to Strings
Strings
Strings are one of the most common data types in programming languages. You can think of strings as the data type that stores text or characters within quotes.
What the following lessons will teach you is how to create strings and then manipulate them to your liking. You’ll then be tested on what you learned and your ability to use what you learned to do something entirely new in the hacks.
For this introductory page, we’ll go over characteristics of strings applicable by both Python & JS.
Characteristics
-
Strings are immutable This means once a string has been created, it can’t be modified, requiring the programmer to create new strings when manipulating the original string to save the changes.
-
Strings can be indexed. Indexing strings is the process of accessing a character or characters from a string. This is often helpful when we only want a key part of a string.
-
Strings can be concatenated. Concatenating strings is the process of combining two strings together to make one new one.
-
Strings use methods/functions. Methods or Functions allow us to manipulate strings in a variety of ways and for a variety of reasons.
There are further characteristics of strings, but one should get gist from the first four. Many of these characteristics are essential topics that we delve into more for both Python & JavaScript, such as concatenation and functions, and henceforth, are important to keep in mind.
With this, you should be more than ready to take a look at the lessons.