[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [trim](./js-utils.trim.md) ## trim() function Return the start of `val`, up to `max` characters. If `val` is longer than `max` and there is room, suffix with `tail`. Signature: ```typescript export declare function trim(val: string, max: number, tail?: string): string; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | val | string | | | max | number | | | tail | string | (Optional) | Returns: string