1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
-
|
|
-
|
|
!
| #module
#defcfunc MbsbTypeByte int byt
return ((byt>=0x81)&(byt<=0x9f) )|( (byt>=0xe0)&(byt<=0xfc))
#defcfunc MbsbType var p1, int p2
bcnt = p2
repeat p2
if MbsbTypeByte(peek(p1, p2-cnt-1)) = 0 : bcnt = cnt : break
loop
if bcnt\2 {
return 2
} else {
return MbsbTypeByte(peek(p1, p2))
}
#defcfunc StrInsert var pstr, var pstrin, int in
if in<0 : ina = 0 : else : ina = in
if MbsbType(pstr,ina)>1 : ina--
return strmid(pstr, 0, ina) + pstrin + strmid(pstr, ina, strlen(pstr)-ina)
#defcfunc StrDel var strp1, int delp, int delnum
return strmid(strp1, 0, delp) + strmid(strp1, delp+delnum, strlen(strp1)-(pd1+pd2))
#global
a = "こaんにbちはc!"
c = ""
mes "文字タイプ判定-----"
mes a
repeat 12
if MbsbType(a, cnt)=1 : wpoke c, 0, wpeek(a, cnt)
if MbsbType(a, cnt)=0 : poke c, 0, peek(a, cnt) : poke c, 1, 0
mes ""+c+"("+peek(a,cnt)+")("+MbsbType(a, cnt)+") _"+MbsbTypeByte(peek(a,cnt))
loop
pos 200,0
a = "こんにちは!"
b = "a"
mes "挿入-----"
mes "「"+a+"」に "+b+" を挿入。"
repeat 12
mes StrInsert(a,b,cnt)
loop
pos 0,300
a = "こんにちは!"
b = "a"
mes "削除-----"
mes a
repeat 6
mes StrDel(a, cnt*2, 2)
loop
stop
|