马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
PB2021全角转半角测试通过。
- /*
- * Script Name: Script - Full2Half(string in_str,integer iflag)
- * Description: 用于全角,半角互相转换的函数
- * Arguments: string strInfo //需要转换的字符串
- int iFlag // 1-全角-》半角 2-半角》全角
- * Returns: string
- * Author: Date: 2009-02-26 09:08:58
- */
- String ls_rtn
- Char c[]
- long ll_length,ll_i
- If IsNull(in_str) Or in_str = "" Then Return ""
- ll_length = len(in_str)
- if iflag=1 then //1-全角-》半角
- For ll_i = 1 To ll_length
-
- c[ll_i] = char(mid(in_str, ll_i, 1))
-
- If (Asc(c[ll_i]) = 12288) Then
-
- c[ll_i] = Char(32)
-
- Continue
-
- End If
-
- If (Asc(c[ll_i]) > 65280 and Asc(c[ll_i]) < 65375) Then
-
- c[ll_i] = Char(Asc(c[ll_i]) - 65248)
-
- End If
-
- Next
- elseif iflag=2 then//2-半角》全角
-
-
- For ll_i = 1 To ll_length
-
- c[ll_i] = char(mid(in_str, ll_i, 1))
-
- If (Asc(c[ll_i]) = 32) Then
-
- c[ll_i] = Char(12288)
-
- Continue
-
- End If
-
- If (Asc (c[ll_i]) < 127) Then
-
- c[ll_i] = Char(Asc(c[ll_i]) + 65248)
-
- End If
-
- Next
- end if
- ls_rtn = c
- Return ls_rtn
复制代码
|