Skip to content

Commit

Permalink
Fix trim_end
Browse files Browse the repository at this point in the history
  • Loading branch information
luboslenco committed Jan 23, 2024
1 parent 70e14e1 commit 43fafb8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Sources/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ let array_remove = (ar: any[], e: any) => {
}

let trim_end = (str: string): string => {
while (str.length > 0 && str[str.length - 1] == " ") str = str.substring(0, str.length - 1);
while (str.length > 0 && (str[str.length - 1] == " " || str[str.length - 1] == "\n")) {
str = str.substring(0, str.length - 1);
}
return str;
}

Expand Down

0 comments on commit 43fafb8

Please sign in to comment.