text-helper.ts raw

   1  export class TextHelper {
   2    /**
   3     * Takes a string returns something like "\<first-x-chars>...\<last-y-chars>""
   4     */
   5    static split(text: string, first: number, last: number): string {
   6      return `${text.slice(0, first)}...${text.slice(-last)}`;
   7    }
   8  }
   9