1 /**/ /// <Summary>
2 /// SBC case Function)
3 /// </Summary>
4 /// <Param name = "input"> Any string </Param>
5 /// <Returns> Fullwidth string </Returns>
6 /// <Remarks>
7 /// The full-width space is 12288, and the half-width space is 32.
8 /// The correspondence between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248.
9 /// </Remarks>
10 Public Static String Tosbc ( String Input)
11 {
12 // Halfwidth to fullwidth:
13 Char [] C = Input. tochararray ();
14 For ( Int I = 0 ; I < C. length; I ++ )
15 {
16 If (C [I] = 32 )
17 {
18 C [I] = ( Char ) 12288 ;
19 Continue ;
20 }
21 If (C [I] < 127 )
22 C [I] = ( Char ) (C [I] + 65248 );
23 }
24 Return New String (C );
25 }
26
27
28 /**/ /// <Summary>
29 /// Function for halfwidth conversion (DBC case)
30 /// </Summary>
31 /// <Param name = "input"> Any string </Param>
32 /// <Returns> Halfwidth string </Returns>
33 /// <Remarks>
34 /// The full-width space is 12288, and the half-width space is 32.
35 /// The correspondence between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248.
36 /// </Remarks>
37 Public Static String Todbc ( String Input)
38 {
39 Char [] C = Input. tochararray ();
40 For ( Int I = 0 ; I < C. length; I ++ )
41 {
42 If (C [I] = 12288 )
43 {
44 C [I] = ( Char ) 32 ;
45 Continue ;
46 }
47 If (C [I] > 65280 && C [I] < 65375 )
48 C [I] = ( Char ) (C [I] - 65248 );
49 }
50 Return New String (C );
51 }