Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0478

Handle strings with built-in operations

Measure a string, extract a substring and change character case using the syllabus routines.

Cambridge IGCSE Computer Science 0478 · Programming · 2026–2028 Version 6 · 8.1
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6. It covers section 8.1 (Programming concepts) only. Pseudocode examples use the published Cambridge format; the separate 2029–2031 syllabus is not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers, a browser-based programming workspace and human subject-teacher review remain outstanding.

Before you begin

  • Be comfortable following an ordered algorithm and tracing variable values. Each lesson introduces the Cambridge pseudocode form it uses.

Work on paper. Try each question before revealing help, and explain why your method works.

Quick readiness check

How many characters does LENGTH count in a string?

What you will learn

  • Use LENGTH to measure a string
  • Use SUBSTRING with a start and length
  • Use UCASE and LCASE to change case

String routines return new values

LENGTH(Text) returns the number of characters. UCASE(Text) returns uppercase characters and LCASE(Text) returns lowercase characters.

SUBSTRING(Text, Start, Count) returns Count characters starting at Start. In the published Cambridge pseudocode, the first character generally has position 1, although the syllabus notes that a string may start at 0 or 1 in a programming language.

Keep indexes and lengths within bounds

A substring needs a positive start and length in the stated pseudocode. Check that Start + Count − 1 does not exceed the string length.

Case conversion does not change the stored original unless its returned value is assigned back, for example Name ← UCASE(Name).

Pause and explain

In SUBSTRING("Happy Days", 1, 5), what does the final 5 mean?

Put the idea to work

Worked example

For Text = "StudyForA", find LENGTH(Text), SUBSTRING(Text, 1, 5) and UCASE(Text).

Show the worked solution
  1. Count nine characters in the string.
  2. Start at position 1 and take five characters: Study.
  3. Convert each letter to uppercase.

Answer LENGTH returns 9; SUBSTRING returns "Study"; UCASE returns "STUDYFORA".

Try a topic test

Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.

Test this topic →

From guided practice to a new situation

Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.

1 · Guided

For Code = "AB-204", find LENGTH(Code) and UCASE(Code).

Give me a hint

Count the hyphen as a character.

Compare my reasoning
  1. Count A, B, -, 2, 0 and 4.
  2. There are six characters.
  3. The letters are already uppercase.

LENGTH is 6; UCASE(Code) is "AB-204".

Look for these in your work

  • All characters counted
  • Case result
2 · Independent

Extract "Days" from "Happy Days" using Cambridge's 1-based positions.

Give me a hint

The D is at position 7 and the word contains four characters.

Compare my reasoning
  1. Set Start to 7.
  2. Set Length to 4.
  3. Use SUBSTRING with both values.

SUBSTRING("Happy Days", 7, 4) returns "Days".

Look for these in your work

  • Start position
  • Length
3 · Transfer

A program extracts 3 characters starting at position 8 from a 10-character string. Is the request within bounds? Explain.

Give me a hint

The last position is Start + Length − 1.

Compare my reasoning
  1. Calculate 8 + 3 − 1 = 10.
  2. The substring ends at the final character.
  3. No position exceeds the string length.

Yes; it uses positions 8, 9 and 10, which fit a 10-character string.

Look for these in your work

  • Endpoint calculated
  • Bounds checked

Common mistakes

  • Confusing a substring's start position with its number of characters
  • Using a zero-based index in the pseudocode example without stating that convention
  • Expecting UCASE to modify the original variable automatically
Recall without your notes

What can you explain now?

What does LENGTH("Happy Days") return?

Compare with the explanation

10

The space counts as a character.

After trying it yourself, choose your next review. This is your self-assessment.

Your review choice appears on Today. Sign in to sync it across devices.

Make it stick

Which SUBSTRING parameter gives the number of characters to return?

If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.

Keep learning Computer Science

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 6 syllabus, with worked explanations and guided, independent and transfer practice. This is mapped teaching coverage, not proof of full exam readiness. Three earlier starter lessons remain available but are not counted as syllabus-mapped teaching. Practical programming experience in an executable browser workspace, full timed-paper practice, human subject-teacher review and the separate 2029–2031 syllabus remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.