Skip to content

Instantly share code, notes, and snippets.

@taroyanaka
Last active January 5, 2025 13:59
Show Gist options
  • Save taroyanaka/cee430794ea740e89b1d5965d1a0f8a3 to your computer and use it in GitHub Desktop.
Save taroyanaka/cee430794ea740e89b1d5965d1a0f8a3 to your computer and use it in GitHub Desktop.
YMM4の台本ファイル作るJSファイル名前を変えて適当に動かす。出力ファイルは.txt形式で
// Input multiline string
const input = `ボケです
ツッコミです
殴られ役です
ツッコミは暴力じゃねえから
ドカ、バキ、ボケは達した
マゾのボケなんかい!`;
// Process each line
const processed = input
.trim() // Remove leading/trailing empty lines
.replace(/「/g, '『') // Replace 「 with 『
.replace(/」/g, '』') // Replace 」 with 』
.split('\n') // Split into individual lines
.map((line, index) => (index % 2 === 0 ? `taro_zunda「${line}」` : `kami_himari「${line}」`)) // Add prefix based on line index
.join('\n'); // Join lines back into a single string
console.log(processed);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment