2019-12-24 01:57:07 +09:00
|
|
|
export function capitalize(text: string): string {
|
2019-09-24 13:55:43 +09:00
|
|
|
if (text.length === 0) return '';
|
2019-09-17 14:30:26 +09:00
|
|
|
return text[0].toUpperCase() + text.slice(1).toLowerCase();
|
2019-07-31 01:12:51 +09:00
|
|
|
}
|
2020-02-05 17:28:22 +09:00
|
|
|
|
|
|
|
export function sanitize(text: string): string {
|
|
|
|
return text.replace(/[\s@+!#$%^&*()[\]./<>{}]/g, '');
|
|
|
|
}
|
2020-02-06 00:32:05 +09:00
|
|
|
|
|
|
|
export function upper(word: string): string {
|
|
|
|
return word.toUpperCase();
|
|
|
|
}
|
|
|
|
|
|
|
|
export function lower(word: string): string {
|
|
|
|
return word.toLowerCase();
|
|
|
|
}
|
|
|
|
|
|
|
|
export function stem(word: string): string {
|
|
|
|
return word.replace(/[aiueo]$/, '');
|
|
|
|
}
|
|
|
|
|
|
|
|
export function germanify(word: string): string {
|
|
|
|
return word.replace('c', 'k').replace('C', 'K');
|
|
|
|
}
|
|
|
|
|
|
|
|
export function njoin(lhs: string, rhs: string): string {
|
|
|
|
return lhs + rhs.replace(new RegExp(`^${lhs[-1]}`, 'i'), '');
|
|
|
|
}
|