Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 669 Bytes

chomp.md

File metadata and controls

33 lines (21 loc) · 669 Bytes

strings.chomp

export function chomp *(string(string, [separator])*

Chomp removes record separator characters (ex \n, \r, \r\n) from the end of a string.

Arguments

  1. string (string): input string
  2. [separator] (string): separator removed from end of string *(default '\r' | '\n' | '\r\n')*

Returns

(string): does the input end with the substring?

Example

const result = strings.chomp('Goldy\n\r\n');
console.log(result);
> 'Goldy\n'