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.


" 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.

Hey You!

I'm looking for paid writing gigs. If you're a publisher looking for a writer, please reach out to me at my email

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