//http://prograpark.ninja-web.net/HSP/lab/StrReplace.html //↑ここのモジュールを引用しました #module #defcfunc replace str p1, str target, str after dim len, 2 len = strlen(p1), strlen(target) sdim string, len + 1 // 置換前文字列を格納する変数を用意 string = p1 // instr するので、いったん変数に移す i = 0 // リセット repeat n = instr(string, i, target) if ( n < 0 ) { break } i += n string = strmid(string, 0, i) + after + strmid(string, i + len(1), len(0) - i) i += len(1) await 0 // とりあえずフリーズしません loop return string #global dim memmes,10 *nameselect redraw 0 color 255,255,255 : boxf //pに文字を入れとく p=" 1"," 2"," 3"," 4"," 5"," 6"," 7"," 8"," 9"," 0"," A"," B"," C"," D"," E"," F"," G"," H"," I"," J"," K"," L"," M"," N"," O"," P"," Q"," R"," S"," T" p(30)=" U"," V"," W"," X"," Y"," Z"," ,"," 。","!","?"," a"," b"," c"," d"," e"," f"," g"," h"," i"," j"," k"," l"," m"," n"," o"," p"," q"," r"," s"," t"," u"," v"," w"," x"," y"," z"," /"," _"," ―"," EN" //文字表示 repeat 10 nm=cnt pos 130+cnt*40,280 repeat 7 pms=nm+(cnt*10) if pselect=pms : color 255 : else : color 0,0,0 mes p(pms) loop loop pos 0,0 mes ssmes //選択 stick k if k=1&pselect>0 : pselect-- if k=2 : pselect-10 if k=4&pselect<69 : pselect++ if k=8: pselect+10 if k=16&pselect!69&cc!10{ ssmes+p(pselect) : memmes(cc)=p(pselect) : cc++ } if k=64&cc!0 : ssmes=replace(ssmes, memmes(cc-1), "") : cc-- if k=16&pselect=69 : end if pselect<0 : pselect+70 if pselect>69 : pselect-70 redraw 1 await 16 goto *nameselect
名前入力画面を作ろうと思ってこんなものを作りました。、
Ctrlキーを押したときにひとつ前の文字が消えるようにしたいのですが、
同じ文字をすべて消してしまいます。
一応原因は変数memmesに代入した文字をすべて消しているからなのですが、
対策がわかりません。ご教授願います。