Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 624 Bytes

chomp.md

File metadata and controls

33 lines (21 loc) · 624 Bytes

strings.chomp

chomp(string, [separator='\r'||'\n'||'\r\n'])

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

Arguments

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

Returns

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

Example

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