Ad space (banner)
Lesson 16 / 20

Working with strings

This lesson covers basic string handling in Dart.

Strings come with handy properties and methods such as length, toUpperCase() for upper-casing, and substring() for taking a piece out.

The sample code checks the character count with message.length and takes the first five characters with message.substring(0, 5).

A common early stumble is that the "end" in substring(start, end) is not included. substring(0, 5) takes the five characters at positions 0 through 4.

In professional work, string handling — validating user input, shaping the text shown in the interface — is essential in practically every app.

๐Ÿ“– Reference code
โœ๏ธ Your code
Type your code, then press "Run"

๐Ÿงช This site can't compile or run Dart directly, so it checks on the spot whether what you typed matches the reference code (scoring happens entirely in your browser โ€” nothing is sent anywhere).

Ad space (banner)
Ad space (in-article)