Private Function AscToChar(ByVal sAsc As String) As String Dim iLen As Integer Dim i As Integer On Error GoTo err_Trans AscToChar = "" iLen = CInt(Len(sAsc) / 2) For i = 0 To iLen - 1 If CInt("&H" & Mid(sAsc, i * 2 + 1, 2)) < &H20 Then AscToChar = "" Exit Function Else AscToChar = AscToChar & Chr(CInt("&H" & Mid(sAsc, i * 2 + 1, 2))) End If Next iexit_Trans: Exit Functionerr_Trans: AscToChar = "" Resume exit_Trans End Function
2 回答
慕莱坞森
TA贡献1810条经验 获得超4个赞
private string AscToChar(string sAsc)
{
string functionReturnValue = null;
int iLen = 0;
int i = 0;
// ERROR: Not supported in C#: OnErrorStatement
functionReturnValue = "";
iLen = Convert.ToInt32(Strings.Len(sAsc) / 2);
for (i = 0; i <= iLen - 1; i++) {
if (Convert.ToInt32("&H" + Strings.Mid(sAsc, i * 2 + 1, 2)) < 0x20) {
functionReturnValue = "";
return functionReturnValue;
} else {
functionReturnValue = functionReturnValue +
Strings.Chr(Convert.ToInt32("&H" + Strings.Mid(sAsc, i * 2 + 1, 2)));
}
}
exit_Trans:
return functionReturnValue;
err_Trans:
functionReturnValue = "";
// ERROR: Not supported in C#: ResumeStatement
return functionReturnValue;
}
- 2 回答
- 0 关注
- 273 浏览
添加回答
举报
0/150
提交
取消