I am seeking a solution to capitalize the first letter in a given string, like so:
sumo => Sumo
Additionally, I need to capitalize strings in the following format:
Dr.ravi kumar => Dr.Ravi kumar
Although I have implemented an Angular filter that successfully handles the first scenario, it does not work for the second one. Here is the custom filter that I am currently using:
angular
.module('app')
.filter('capitalize', function () {
return function (input, scope) {
if (input != null) {
input = input.toLowerCase();
return input.substring(0, 1).toUpperCase() + input.substring(1);
}
}
});