#include "hsp3utf.as" #module #defcfunc getBy […]
#include "hsp3utf.as" #module #defcfunc getBy […]
#include "hsp3utf.as"
#module
#defcfunc getByte_u8 int p1
if ((p1 >= 0x00) && (p1 <= 0x7f)) {
return 1
} else : if ((p1 >= 0xc2) && (p1 <= 0xdf)) {
return 2
} else : if ((p1 >= 0xe0) && (p1 <= 0xef)) {
return 3
} else : if ((p1 >= 0xf0) && (p1 <= 0xf7)) {
return 4
} else : if ((p1 >= 0xf8) && (p1 <= 0xfb)) {
return 5 // 廃止された?
} else : if ((p1 >= 0xfc) && (p1 <= 0xfd)) {
return 6 // 廃止された?
}
return 0
#defcfunc getCount str _txt
txt = _txt
count = 0
repeat strlen(txt)
chars = getByte_u8( peek( txt, cnt))
count++
continue cnt + chars
loop
return count
#global
// 文字数のカウント
txt = "あいうえおABCDE♨" // 11文字
mes txt
mes "" + getCount(txt) + "文字"