/** // <Summary>
/// Halfwidth to fullwidth
/// </Summary>
/// <Param name = "bjstr"> </param>
/// <Returns> </returns>
Static Public String getquanjiao (string bjstr)
...{
... # Region
Char [] C = bjstr. tochararray ();
For (INT I = 0; I <C. length; I ++)
...{
Byte [] B = system. Text. encoding. Unicode. getbytes (C, I, 1 );
If (B. Length = 2)
...{
If (B [1] = 0)
...{
B [0] = (byte) (B [0]-32 );
B [1] = 255;
C [I] = system. Text. encoding. Unicode. getchars (B) [0];
}
}
}
String strnew = new string (C );
Return strnew;
# Endregion
}
/** // <Summary>
/// Convert the fullwidth to halfwidth
/// </Summary>
/// <Param name = "qjstr"> </param>
/// <Returns> </returns>
Static Public String getbanjiao (string qjstr)
...{
... # Region
Char [] C = qjstr. tochararray ();
For (INT I = 0; I <C. length; I ++)
...{
Byte [] B = system. Text. encoding. Unicode. getbytes (C, I, 1 );
If (B. Length = 2)
...{
If (B [1] = 255)
...{
B [0] = (byte) (B [0] + 32 );
B [1] = 0;
C [I] = system. Text. encoding. Unicode. getchars (B) [0];
}
}
}
String strnew = new string (C );
Return strnew;
# Endregion
}
3. concerning the problem of full-width to half-width conversion, in UNICODE, the highest half-width encoding of punctuation, numbers, and letters is 0, and their full-width encoding is 32 h different from the third half-width encoding.