Length, Position, Substring & Concatenation Flashcards
All 6 cards in this deck
In AQA pseudo-code, how do you join two strings together?
e.g. join
firstNameandsurnamewith a space between themWith the
+operator (concatenation):fullName ← firstName + ' ' + surnameIn AQA pseudo-code, how do you find the number of characters in a string?
e.g.
word ← 'computer'LEN(word), which gives8.What does
SUBSTRING(start, end, s)return in AQA pseudo-code?e.g.
SUBSTRING(3, 7, 'computer')The characters of
sfrom positionstartto positionend, with both included and positions counted from 0. Here it returns'puter'.True or false?
LENcounts spaces and punctuation when finding the number of characters in a string.True.
LENcounts every character, including spaces and punctuation, e.g.LEN('Hi, Sam')is 7.What does
POSITION(s, c)return in AQA pseudo-code?e.g.
POSITION('keyboard', 'b')The position of the first occurrence of the character
cin the strings, counting from 0. Here it returns 3.In AQA pseudo-code, how do you get a single character from a string?
e.g. the first letter of
nameUse
SUBSTRINGwith the same start and end position, counting from 0:SUBSTRING(0, 0, name)