プログラミングのお題スレ Part22 (859レス)
プログラミングのお題スレ Part22 http://mevius.5ch.net/test/read.cgi/tech/1691038333/
上
下
前次
1-
新
通常表示
512バイト分割
レス栞
抽出解除
必死チェッカー(本家)
(べ)
自ID
レス栞
あぼーん
112: デフォルトの名無しさん [sage] 2023/09/30(土) 18:00:29.42 ID:oqu6hf3+ >>111 node const swap = (text, [w1, w2]) => text.split(w1).map(v => v.replaceAll(w2, w1)).join(w2) const swapAll = (text, rules) => rules.reduce(swap, text) const text = '緑のカバンに500万入れて白の紙で黄色のカバン言うて書きながら赤のカバン言いながら置いてくれたら俺黒のカバン言いながら取りに行くわ' const rules = [['赤', '緑'], ['黒', '白'], ['黄', '青']] const replaced = swapAll(text, rules) // console.log(replaced) console.log(replaced === '赤のカバンに500万入れて黒の紙で青色のカバン言うて書きながら緑のカバン言いながら置いてくれたら俺白のカバン言いながら取りに行くわ') // true http://mevius.5ch.net/test/read.cgi/tech/1691038333/112
メモ帳
(0/65535文字)
上
下
前次
1-
新
書
関
写
板
覧
索
設
栞
歴
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
AAサムネイル
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.034s