Programming Basics
What Is a String in Programming?
A string is a sequence of characters, such as a word or a sentence, stored as text and written inside quotes in most languages.
Definition
A string is text data: a sequence of characters such as letters, digits, spaces and symbols. In code it is written inside quotes, like "hello".
Names, messages, file paths and JSON documents are all strings.
How it works
Each character has a position (index) starting at 0, so you can read one character or slice out a part. Strings come with built-in methods to search, replace, split and change case.
In Python, Java and JavaScript, strings are immutable: methods return a new string instead of changing the original.
Each character is stored as a number from an encoding. Most modern code uses Unicode with UTF-8, which is why the letter A takes one byte while an emoji takes four.