mc #5621(2008/02/01 14:24 GMT) [ Arc ] Rating1/1=1.00
1 2 3 4 5 6 7 8
;; 基本版/Arc (def tr (orig subst str) (tostring (each c str (pr (aif (pos c orig) (subst it) c))))) (tr "qwertyuiop" "QWERTYUIOP" "typewriter") ;=>"TYPEWRITER"
Rating1/1=1.00-0+
[ reply ]
mc
#5621()
[
Arc
]
Rating1/1=1.00
予め言語内に用意されている場合は、(1)一般的な使用法と、(2)より進んだ使用方法を提示して下さい。
'ABCDEF'と'abcdef'等すべて対応する文字を書く必要があるものを、(1)基本版、'A-Z'と'a-z'のように"-"で範囲を指定できるものを(2)拡張版、2を更に発展させたものを(3)発展版とします。任意のものを選んで解答して下さい。
実行例. (与えられた文字列が、"typewriter"の場合)
tr 'qwertyuiop' 'QWERTYUIOP' "typewriter"
=> TYPEWRITER
;; 基本版/Arc (def tr (orig subst str) (tostring (each c str (pr (aif (pos c orig) (subst it) c))))) (tr "qwertyuiop" "QWERTYUIOP" "typewriter") ;=>"TYPEWRITER"Rating1/1=1.00-0+
[ reply ]