mirror of https://github.com/openclaw/openclaw.git
23 lines
502 B
TypeScript
23 lines
502 B
TypeScript
export function isIrcControlChar(charCode: number): boolean {
|
|
return charCode <= 0x1f || charCode === 0x7f;
|
|
}
|
|
|
|
export function hasIrcControlChars(value: string): boolean {
|
|
for (const char of value) {
|
|
if (isIrcControlChar(char.charCodeAt(0))) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
export function stripIrcControlChars(value: string): string {
|
|
let out = "";
|
|
for (const char of value) {
|
|
if (!isIrcControlChar(char.charCodeAt(0))) {
|
|
out += char;
|
|
}
|
|
}
|
|
return out;
|
|
}
|