util: countLines func

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2024-06-20 13:27:40 +02:00
parent 680ab5bdf1
commit b56d9771d7
2 changed files with 40 additions and 0 deletions

View File

@@ -185,4 +185,8 @@ export class Util {
.map(char => `&#x${char.charCodeAt(0).toString(16)};`)
.join('');
}
public static countLines(input: string): number {
return input.split(/\r\n|\r|\n/).length;
}
}