Posted by & filed under Dictionary.

1、Club StartKit の構築
2006.1.18Personal StartKitに移植する(Skinのサポート)
2、RapTierの導入
3,漢字の判断:
C#:

protected bool IsKanji(string strInput)
{
UnicodeEncoding utf16 = new UnicodeEncoding();
byte[] bytes;
bytes = utf16.GetBytes(strInput);
if (bytes.Length < 2)
{
return false;
}
double intNum;
intNum = bytes[1] * (Math.Pow(2, 8) ) + bytes[0];
if (intNum >= 11904 & intNum <= 12031)
{
return true;
}
if (intNum >= 12032 & intNum <= 12255)
{
return true;
}
if (intNum >= 12544 & intNum <= 12735)
{
return true;
}
if (intNum >= 12704 & intNum <= 12735)
{
return true;
}
if (intNum >= 13312 & intNum <= 19903)
{
return true;
}
if (intNum >= 19968 & intNum <= 40879)
{
return true;
}
if (intNum >= 63744 & intNum <= 64255)
{
return true;
}
return false;
}

VB.NET:
Private Function IsKanji(ByVal strInput As String) As Boolean
Dim utf16 As New UnicodeEncoding
Dim bytes() As Byte
bytes = utf16.GetBytes(strInput)

‘Dim sjisEnc As Encoding = Encoding.GetEncoding(”Unicode”)
‘Dim bytes() As Byte = sjisEnc.GetBytes(strInput)
If bytes.Length < 2 Then
Return False
End If
‘If bytes(1) = &H0 Then
‘ Return False
‘End If
Dim intNum As Integer
intNum = bytes(1) * (2 ^ 8) + bytes(0)

If intNum >= &H2E80 And intNum <= &H2EFF Then
Return True
End If
If intNum >= &H2F00 And intNum <= &H2FDF Then
Return True
End If
If intNum >= &H3100 And intNum <= &H31BF Then
Return True
End If
If intNum >= &H31A0 And intNum <= &H31BF Then
Return True
End If
If intNum >= &H3400 And intNum <= &H4DBF Then
Return True
End If
If intNum >= &H4E00 And intNum <= &H9FAF Then
Return True
End If
If intNum >= &HF900 And intNum <= &HFAFF Then
Return True
End If
‘If intNum >= &H889F Then
‘ Return True
‘End If
‘IsKanji = False
‘If (bytes(0) > &H7F) And (((bytes(1) >= &H40) And (bytes(1) <= &H7E)) Or ((bytes(1) >= &H80) And (bytes(1) <= &HFC))) Then
‘ IsKanji = False ‘漢字の範囲で
‘Else
‘End If
End Function

Comments are closed.