Site Logo Mukhthar CM Home

The Dart String Trim method

Aug 21, 2021

The Dart trim() method returns the given String after removing whitespaces at the beginning and end of the String.

Examples

" SampleText".trim() // "SampleText"
"SampleText ".trim() // "SampleText"
" SampleText ".trim() // "SampleText"
"SampleText".trim() // "SampleText"

Note that, this will not remove whitespace in the middle of a sentence.

Join my email list to get the latest posts and updates.