toBeginningOfSentenceCase<T extends String?> function
- T input, [
- String? locale
Convert a string to beginning of sentence case, in a way appropriate to the locale.
Currently this just converts the first letter to uppercase, which works for many locales, and we have the option to extend this to handle more cases without changing the API for clients. It also hard-codes the case of dotted i in Turkish and Azeri.
Implementation
T toBeginningOfSentenceCase<T extends String?>(T input, [String? locale]) {
if (input == null || input.isEmpty) return input;
return '${_upperCaseLetter(input[0], locale)}${input.substring(1)}' as T;
}