#module
#deffunc addcomma int
mref value, 0
mref rstr, 65
if value < 0 : i = value * -1 : else : i = value
flg = value < 0 // マイナス時1、その他0
rstr = ""
repeat
tmp = i \ 1000
if cnt : s = "," + rstr : else : s = ""
if i / 1000 {
tmp = "000" + tmp
strmid tmp, tmp, -1, 3
rstr = tmp + s
i = i / 1000
} else {
rstr = "" + tmp + s
break
}
loop
if flg : rstr = "-" + rstr // マイナスだったなら符号を付ける
return
#deffunc delcomma str
mref string, 32
mref stt, 64
stt = 0
repeat
instr chk, string, "," // コンマを検索し、あれば除去
if chk = -1 : break
strlen i, string
strmid tmp, string, chk + 1, i - chk
strmid string, string, , chk
string += tmp
loop
stt = 0 + string
return
#global
data = 1, 22, 333, 4444, 55555, 666666, 7777777, 88888888, 999999999
repeat 9
addcomma data.cnt // 3桁区切りコンマをつける
pos 10, cnt * 20 + 10 : mes data.cnt
pos 120, cnt * 20 + 10 : mes "→"
pos 170, cnt * 20 + 10 : mes refstr
delcomma refstr // 3桁区切りコンマを外す
pos 280, cnt * 20 + 10 : mes "→"
pos 330, cnt * 20 + 10 : mes stat
loop
stop
|