漢字判定
Let([
$Target=test::文字;
$F="Case (
12832 ≤ $c and $c ≤ 12868 ; $S ;
12928 ≤ $c and $c ≤ 12976 ; $S ;
13312 ≤ $c and $c ≤ 40959 ; $S ;
63744 ≤ $c and $c ≤ 64255 ; $S ;
131072 ≤ $c and $c ≤ 196607 ; $S ;
$S=\"々\" ; $S ;
code($S)=code(\"〇\") ; $S ;
$S=\"〻\" ; $S ;
int($n)>100 ; 0 ;/*100文字まで*/
Let ([
$n=$n+1;
$S=Middle ( $Target ; $n ; 1 );
$C=Code($S)];
Evaluate ( $F )
)
)"
];
Evaluate ( $F )
)
/*
参考:
【Unicodeで「漢字」の正規表現】
http://tama-san.com/?p=196
*/
【漢字カウントLOOP】
変数を設定 [$Target; 値:test::文字]
変数を設定 [$max; 値:Length ( $Target )]
変数を設定 [$n; 値:1]
Loop
Exit Loop If [$n>$max]
変数を設定 [$S; 値:Middle ( $Target ; $n ; 1 )]
変数を設定 [$C; 値:Code($S)]
変数を設定 [$i; 値:$i + Case (
12832 ≤ $c and $c ≤ 12868 ; 1 ;
12928 ≤ $c and $c ≤ 12976 ; 1 ;
13312 ≤ $c and $c ≤ 40959 ; 1 ;
63744 ≤ $c and $c ≤ 64255 ; 1 ;
131072 ≤ $c and $c ≤ 196607 ; 1 ;
$S="々" ; 1 ;
Code($S)=Code("〇") ; 1 ;
$S="〻" ; 1 ;
""
)
変数を設定 [$n; 値:$n+1]
End Loop
フィールド設定 [test::result; $i]