The syntax of String.toLowerCase() method is:
String toLowerCase()
This toLowerCase() method of String converts all characters in this string to lower case.
String.toLowerCase() returns value of type String
.
In this example,
str
with the value 'Hello, World!'.toLowerCase()
method to convert all characters in the string to lowercase.lowerCaseStr
.void main() {
String str = 'Hello, World!';
String lowerCaseStr = str.toLowerCase();
print('Original String: $str');
print('Lowercase String: $lowerCaseStr');
}
Original String: Hello, World! Lowercase String: hello, world!
In this example,
str
with the value 'ABCDEF'.toLowerCase()
method to convert all characters in the string to lowercase.lowerCaseStr
.void main() {
String str = 'ABCDEF';
String lowerCaseStr = str.toLowerCase();
print('Original String: $str');
print('Lowercase String: $lowerCaseStr');
}
Original String: ABCDEF Lowercase String: abcdef
In this example,
str
with the value 'Lorem Ipsum Dolor Sit Amet'.toLowerCase()
method to convert all characters in the string to lowercase.lowerCaseStr
.void main() {
String str = 'Lorem Ipsum Dolor Sit Amet';
String lowerCaseStr = str.toLowerCase();
print('Original String: $str');
print('Lowercase String: $lowerCaseStr');
}
Original String: Lorem Ipsum Dolor Sit Amet Lowercase String: lorem ipsum dolor sit amet
In this Dart tutorial, we learned about toLowerCase() method of String: the syntax and few working examples with output and detailed explanation for each example.