In this guide, we will discuss the String trim() Method in Dart Programming Language. Returns a new string by removing all leading and trailing spaces. However, this method doesn’t discard spaces between two strings.
Syntax
String.trim()
Return Type
Returns a string.
Example
void main() { String str1 = "hello"; String str2 = "hello world"; String str3 = "hello"; print(str1.trim()); print(str2.trim()); print(str3.trim()); }
It will produce the following output −.
hello hello world hello
Next Topic : Click Here
Pingback: String toUpperCase() Method | Adglob Infosystem Pvt Ltd
Pingback: Dart Programming - String | Adglob Infosystem Pvt Ltd