mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-29 16:16:02 +00:00
chore: merge
This commit is contained in:
7
src/pages/tools/string/rot13/service.ts
Normal file
7
src/pages/tools/string/rot13/service.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export function rot13(input: string): string {
|
||||
return input.replace(/[a-zA-Z]/g, (char) => {
|
||||
const charCode = char.charCodeAt(0);
|
||||
const baseCode = charCode >= 97 ? 97 : 65; // 'a' or 'A'
|
||||
return String.fromCharCode(((charCode - baseCode + 13) % 26) + baseCode);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user