Due to the restrictions on Field Types in some databases corresponding to txtbox, sometimes when full-angle characters are written in, a problem may occur during statistics query.
It is better to switch. You can choose to convert the full angle into a half angle before saving it, And then store it in, so there will be no problem during statistics. 1 Halfwidth Interchange # Region Halfwidth Interchange
2 /**/ /// <Summary>
3 /// SBC case Function)
4 /// </Summary>
5 /// <Param name = "input"> Any string </Param>
6 /// <Returns> Fullwidth string </Returns>
7 /// <Remarks>
8 /// The full-width space is 12288, and the half-width space is 32.
9 /// The correspondence between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248.
10 /// </Remarks>
11 Public Static String Tosbc ( String Input)
12 {
13 // Halfwidth to fullwidth:
14 Char [] C = Input. tochararray ();
15 For ( Int I = 0 ; I < C. length; I ++ )
16 {
17 If (C [I] = 32 )
18 {
19 C [I] = ( Char ) 12288 ;
20 Continue ;
21 }
22 If (C [I] < 127 && C [I] > 32 )
23 {
24 C [I] = ( Char ) (C [I] + 65248 );
25 }
26 }
27 Return New String (C );
28 }
29
30 /**/ /// <Summary>
31 /// Function for halfwidth conversion (DBC case)
32 /// </Summary>
33 /// <Param name = "input"> Any string </Param>
34 /// <Returns> Halfwidth string </Returns>
35 /// <Remarks>
36 /// The full-width space is 12288, and the half-width space is 32 (spaces are not required here)
37 /// The correspondence between the half-width (33-126) of other characters and the full-width (65281-65374) is as follows: the difference is 65248.
38 /// </Remarks>
39 Public Static String Todbc ( String Input)
40 {
41 Char [] C = Input. tochararray ();
42 For ( Int I = 0 ; I < C. length; I ++ )
43 {
44 If (C [I] = 12288 )
45 {
46 C [I] = ( Char ) 32 ;
47 Continue ;
48 }
49 If (C [I] > 65280 && C [I] < 65375 )
50 {
51 C [I] = ( Char ) (C [I] - 65248 );
52 }
53 }
54 Return New String (C );
55 }
56 # Endregion