- 139 名前:デフォルトの名無しさん mailto:sage [2007/12/08(土) 16:52:38 ]
- 過疎っているので、Python スレにあったお題でコードを書いてみました。
"行頭の空白文字列を nbsp に変更するプログラム" fun replaceWhite file = let fun repLn lst = case hd lst of #" " => [#"&", #"n", #"b", #"s", #"p", #";"] @ repLn(tl lst) | #"¥t" => [#"&", #"n", #"b", #"s", #"p", #";", #"&", #"n", #"b", #"s", #"p", #";", #"&", #"n", #"b", #"s", #"p", #";", #"&", #"n", #"b", #"s", #"p", #";"] @ repLn(tl lst) | _ => lst fun replace out = case TextIO.inputLine out of NONE => () | SOME ln => ((print o String.implode o repLn o String.explode) ln; replace out) in (replace o TextIO.openIn) file end;
|

|