h2z/z2h
半角を全角にする。必要だったので作ったが、とても実用レベルではないような気がする。
numalias h2z_str numalias h2z_result numalias h2z_piece ------ ------ ;============================== ; h2z ;============================== ;機能:半角文字を全角文字に変換する。 ;引数:結果を格納する文字変数、変換したい文字列 ;付記:変換した文字列は、全て半角文字で記述される必要がある。 ;付記:強引にやってますので、遅いかも。 *h2z getparam s%h2z_result,$h2z_str mov $%h2z_result,"" len %h2z_str,$h2z_str for %h2z_piece = 0 to %h2z_str mid $h2z_piece,$h2z_str,%h2z_piece,1 if $h2z_piece = "0" add $%h2z_result,"0":goto *h2z_next if $h2z_piece = "1" add $%h2z_result,"1":goto *h2z_next if $h2z_piece = "2" add $%h2z_result,"2":goto *h2z_next if $h2z_piece = "3" add $%h2z_result,"3":goto *h2z_next if $h2z_piece = "4" add $%h2z_result,"4":goto *h2z_next if $h2z_piece = "5" add $%h2z_result,"5":goto *h2z_next if $h2z_piece = "6" add $%h2z_result,"6":goto *h2z_next if $h2z_piece = "7" add $%h2z_result,"7":goto *h2z_next if $h2z_piece = "8" add $%h2z_result,"8":goto *h2z_next if $h2z_piece = "9" add $%h2z_result,"9":goto *h2z_next if $h2z_piece = "+" add $%h2z_result,"+":goto *h2z_next if $h2z_piece = "-" add $%h2z_result,"−":goto *h2z_next if $h2z_piece = "," add $%h2z_result,",":goto *h2z_next if $h2z_piece = "." add $%h2z_result,".":goto *h2z_next if $h2z_piece = " " add $%h2z_result," ":goto *h2z_next if $h2z_piece = "_" add $%h2z_result,"_":goto *h2z_next *h2z_next next return
ごり押しのスクリプティング。
変換できる文字種は限られてるし、しかもそれ以外の文字があったら華麗にスルーすると言う素敵仕様。本当に、数値文字列を全角にするためだけにしか使えない。
まあ、なんかの役には立つと思うよ。