DoRevision Sign up free

String Surgeon

Measure a string, pick out a character by its position, cut out a substring and stitch strings together. Learn the operations that let a program reshape text.

⏱️ 16 min 🎯 14 activities Teachers Not yet rated Students Not yet rated

Revise this, the fun way

Play it interactively, earn XP and build a streak, free.

Start revising free

What you'll cover

Operating on text ✂️

Programs constantly reshape text: measuring it, picking out characters, cutting out parts and stitching pieces together. These are **string-manipulation** operations, and this module puts them under the knife.

Words to know 🔑

Four terms run through this module:

Two kinds of operation ⚖️

Some operations just **find out** about a string; others **build** a new one.

How long is it? 🎯

What does the length of a string tell you?

  • How many characters it has
  • The position of the first letter
  • Whether it is in upper case
  • The colour of the text

Match each operation to what it does 🔗

  • Length
  • Position
  • Substring
  • Concatenation
  • Counts the characters in the string
  • Finds where a character is
  • Takes a part of the string
  • Joins two strings together

Counting from zero 📍

In this pseudocode the characters of a string are counted from **0**. So the first character is at position 0, the second at position 1, and so on. For the word CAT, C is at position 0, A is at position 1, and T is at position 2.

Which ones build? ✅

Select the TWO operations that CHANGE a string into a new one.

  • Taking a substring
  • Joining two strings by concatenation
  • Finding the length
  • Finding a character position

Trace the characters 📊

An interactive activity.

Count the characters 🔢

An interactive activity.

Match each example to its result 🔀

  • The length of HELLO
  • The character at position 0 of CAT
  • Joining CAT and DOG
  • HELLO in lower case
  • 5
  • C
  • CATDOG
  • hello

String surgery in words 🧩

The _____ of a string is how many characters it has. Each character has a position called its _____, which starts at _____. Taking part of a string is called a _____, and joining two strings is called _____.

length index zero substring concatenation size colour one whole splitting

Spot the true statements 🖍️

An interactive activity.

Pick the right tool 🧭

An interactive activity.

Explain the operations ✍️

An interactive activity.