Skip to content

Programming Basics

Strings

The idea, in plain English

A string is just text. It's called a 'string' because characters are strung together like beads on a thread, one letter after another. `"Hello"` is a string. You can measure how long one is, glue two together (called 'concatenation'), change its case, or grab a piece out of the middle.

How it works

  1. 1Write text between quotes to make a string. Either `"double"` or `'single'` quotes usually work.
  2. 2Join strings together with `+`. Measure their length, or change case with built-in tools like 'uppercase'.
  3. 3Pull out part of a string by position. The very first character sits at position 0, called an 'index', not 1.

When you'd use it

Use strings anywhere you work with words: names, messages, file paths, or anything typed by a user or shown on screen.

Common beginner mistakes

  • Forgetting that strings start counting positions at 0, not 1. The first letter is at index 0.
  • Trying to change a string in place. In many languages, you can't edit a string directly. You build a new one instead.

Try it — edit and run

Click the code to edit · press ⌘/Ctrl+↵ to run

Editable code. Tab and Shift+Tab indent. Press Escape, then Tab, to move focus out of the editor.

Expected output — hit Run to try it
Combined: Hello World
Length: 11
Uppercase: HELLO WORLD
First 5 chars: Hello

Not sure this is the right topic? See the learning paths → or where this leads →