Last active
October 27, 2023 02:04
-
-
Save ikasoba/141ce7937caa279d23b7d90ee3faade3 to your computer and use it in GitHub Desktop.
縦書きを横書きにするやつ、行はスペースで区切ること
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a e k k | |
i o a u | |
u k k | |
i e | |
k | |
o |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const translate = (text: string) => { | |
const res: string[] = [], | |
lines = text.split(/[\r\n]+/).map((x) => x.split(/ {1,2}/)); | |
for (const line of lines) { | |
for (let i = 0; i < line.length; i++) { | |
res[i] = (res[i] ?? "") + line[i]; | |
} | |
} | |
return res; | |
}; | |
const script = await Deno.readTextFile(Deno.args[0]); | |
console.log(translate(script).join("\n")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
つかいた