import { Injectable } from '@angular/core' ; @ Injectable ( { providedIn : 'root' } ) export class StringService { removeInvisibleCharacters ( str ) { let result = str . replace ( /[\p{Cf}]/gu , '' ) ; result = result . trim ( ) ; return result ; } }