AQA · GCSE · Computer Science
Course version: 8525 · Version from Sept 2020
String handling operations in a programming language: integer to string
Converting an integer to a string means turning a whole-number value, such as 42, into text "42" so it can be joined to other text or displayed as characters.
Checked against the AQA 8525 specification (opens in a new tab) on .
- Point 10 of 11
Study notes
From the checked teaching notes for this specification point.
The idea
Converting an integer to a string means turning a whole-number value, such as 42, into text "42" so it can be joined to other text or displayed as characters. This is needed when concatenating a number with a message, for example building "Score: " + 42, which fails unless 42 is first converted to a string. The learner should recognise the operation, know the target type is string, and predict the result: the integer 42 becomes the two-character string "42". The digits are unchanged but the type is now text, so it can be concatenated or its length measured. Converting back would need string-to-integer.
What earns the marks
- Identifies that integer-to-string conversion changes a whole-number value into a text (string) value.
- Recognises the need to convert before concatenating a number with text.
- States the target type is string and the digits are preserved, e.g. 42 becomes "42".
- Predicts that the resulting string can be concatenated or have its length measured.
- Distinguishes this from string-to-integer, which reverses the direction.
Common mistakes and how to put them right
Trying to concatenate an integer directly with text.
Put it right: Is to convert the integer to a string first.
Confusing direction with string-to-integer.
Put it right: Is that integer-to-string produces text from a number.
Assuming the value changes.
Put it right: Is that the digits stay the same but the data type becomes string.
Exam tips
- Identify the source type (integer) and target type (string) before answering.
- Link the conversion to a use such as concatenation or display.
- Check the direction: integer to string, not string to integer.
Try the lesson
The start of the String handling operations in a programming language: integer to string lesson, made from checked teaching notes for this specification point.
Have a go first
A program stores the whole number 42 in a variable called score. The programmer wants to join it to the text " points" so the result reads "42 points". Which operation must be applied to score before it is joined to the text?
There is more to this lesson
The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Test your understanding of String handling operations in a programming language: integer to string
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge