Home > @microsoft/node-core-library > Text > ensureTrailingNewline

Text.ensureTrailingNewline() method

Returns the input string with a trailing \n character appended, if not already present.

Signature:

static ensureTrailingNewline(s: string, newlineKind?: NewlineKind): string;

Parameters

Parameter Type Description
s string  
newlineKind NewlineKind  

Returns:

string