xxxxxxxxxx
extension StringExtensions on String {
String capitalize() {
return '${this[0].toUpperCase()}${substring(1)}';
}
}
xxxxxxxxxx
import 'dart:io';
main() {
print("Enter a string : ");
var str = stdin.readLineSync();
if (str[0].toUpperCase() == str[0]) {
print("The first character is uppercase");
} else {
print("The first character is not uppercase");
}
}
xxxxxxxxxx
String word = "uPPer"; // Your String
String lowerCaseTest = word.toLowerCase();
if (word == lowerCaseTest) {
return false; // Not capital letter found
}
return true; // A capital letter as found in word