← Back to Strings
Question 300
Grab the First Few Letters
Grab the First Few Letters
The Substring method lets you pull out a smaller piece of a string. When you call Substring(startIndex, length), it returns the characters that begin at startIndex and continue for length characters. Positions are counted starting at 0. You are given a string named word set to "keyboard". Print just its first three characters by starting at index 0 and taking a length of 3.
Expected Output:
key= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Strings
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.