Skip to content

@technobuddha > library > String > Construction

Function: ensureSuffix()

ts
function ensureSuffix(input: string, suffix: string): string;

Defined in: ensure-suffix.ts:9

Add a suffix to a string, if it does not already have the suffix

Parameters

ParameterTypeDescription
inputstringThe string
suffixstringThe suffix

Returns

string

The string followed by the suffix