/// Function for full-width conversion (SBC case )///
///
Arbitrary string // fullwidth string ///
/// The full-width space is 12288, and the half-width space is 32.
/// The relationship between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248 ///
Public string ToSBC (string input)
{// Halfwidth to fullwidth:
Char [] c = input. ToCharArray ();
For (int I = 0; I <c. Length; I ++)
{
If (c [I] = 32)
{
C [I] = (char) 12288; continue;
}
If (c [I] <127) c [I] = (char) (c [I] + 65248 );
}
Return new string (c );
}
///// The function to the halfwidth (DBC case )///
///
Any string
/// Half-width string ///
/// The full-width space is 12288, and the half-width space is 32.
/// The relationship between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248 ///
Public string ToDBC (string input)
{
Char [] c = input. ToCharArray ();
For (int I = 0; I <c. Length; I ++)
{
If (c [I] = 12288)
{
C [I] = (char) 32; continue;
}
If (c [I]> 65280 & c [I] <65375)
C [I] = (char) (c [I]-65248 );
}
Return new string (c );
}