Files
doneit-web/src/app/services/functions/initials.service.ts
T
tiago.kayaya 80ddf8c764 save
2022-03-28 13:34:01 +01:00

19 lines
388 B
TypeScript

import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class InitialsService {
constructor() { }
getInitials(name:string){
let names = name.split(' '),
initials = names[0].substring(0, 1).toUpperCase();
if (names.length > 1) {
initials += names[names.length - 1].substring(0, 1).toUpperCase();
}
return initials;
}
}