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
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
bool validateStructure(String value){
String pattern = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[!@#\$&*~]).{8,}$';
RegExp regExp = new RegExp(pattern);
return regExp.hasMatch(value);
}
xxxxxxxxxx
extension StringExtensions on String {
String capitalize() {
return '${this[0].toUpperCase()}${substring(1)}';
}
}