0
点赞
收藏
分享

微信扫一扫

Delphi用if else实现 select case、switch语句功能,实现case 以字符串为分类条件。


function  RetTextFromStr(inputstr:string):string;stdcall;
var
i:integer;
begin
  RetTextFromStr:='';
  if inputstr='9000' then
      RetTextFromStr := '成功!'
  else if inputstr='9100' then
       begin
          pcdbeep(20);
          RetTextFromStr := '成功!';
       end
  else if inputstr='6281' then
       RetTextFromStr := '回送的数据可能错误!'
  else if inputstr='6283' then
       RetTextFromStr := '选择文件无效,文件或密钥校验错误!'
  else if inputstr='6400' then
       RetTextFromStr := '状态标志未改变!'
  else if inputstr='6581' then
       RetTextFromStr := '写 EEPROM 不成功!'
  else if inputstr='6700' then
       RetTextFromStr := '长度错误!'
  else if inputstr='6900' then
       RetTextFromStr := 'CLA 与线路保护要求不匹配!'
  else if inputstr='6901' then
       RetTextFromStr := '无效的状态!'
  else if inputstr='6981' then
       RetTextFromStr := '命令与文件结构不相容!'
  else if inputstr='6982' then
       RetTextFromStr := '不满足安全状态!'
  else if inputstr='6983' then
       RetTextFromStr := '密钥被锁死!'
  else if inputstr='6984' then
       RetTextFromStr := 'MAC格式不符合!'
  else if inputstr='6985' then
       RetTextFromStr := '使用条件不满足!'
  else if inputstr='6986' then
       RetTextFromStr := '请先选择文件!'
  else if inputstr='6987' then
       RetTextFromStr := '无安全报文!'
  else if inputstr='6988' then
       RetTextFromStr := '安全报文数据项不正确!'
  else if inputstr='6A80' then
       RetTextFromStr := '数据域参数错误!'
  else if inputstr='6A81' then
       RetTextFromStr := '功能不支持或卡中无MF 或卡片已锁定!'
  else if inputstr='6A82' then
       RetTextFromStr := '文件未找到!'
  else if inputstr='6A83' then
       RetTextFromStr := '记录未找到!'
  else if inputstr='6A84' then
       RetTextFromStr := '文件无足够空间!'
  else if inputstr='6A86' then
       RetTextFromStr := '参数P1 P2 错!'
  else if inputstr='6A88' then
       RetTextFromStr := '密钥未找到!'
  else if inputstr='6B00' then
       RetTextFromStr := '在达到Le/Lc 字节之前文件结束,偏移量错误!'
  else if inputstr='6E00' then
       RetTextFromStr := '无效的CLA!'
  else if inputstr='6F00' then
       RetTextFromStr := '数据无效!'
  else if inputstr='9302' then
       RetTextFromStr := 'MAC 错误!'
  else if inputstr='9303' then
       RetTextFromStr := '应用已被锁定!'
  else if inputstr='9401' then
       RetTextFromStr := '金额不足!'
  else if inputstr='9403' then
       RetTextFromStr := '密钥未找到!'
  else if inputstr='9406' then
       RetTextFromStr := '所需的MAC 不可用!'
  else if inputstr='91AE' then
       RetTextFromStr := '认证失败,请检查命行的参数和前期计算是否错误!'
  else if inputstr='91CA' then
       RetTextFromStr := '上一个命令未完全完成!'
  else if inputstr='917E' then
       RetTextFromStr := '指令长度错误!'
  else if inputstr='9140' then
       RetTextFromStr := '当前目录或应用密钥不存在,请先选择正确的目录或应用!'
  else if inputstr='919D' then
       RetTextFromStr := '处于未验证密码的状态,该指令无法操作!'
  else if inputstr='911E' then
       RetTextFromStr := 'MAC错误!'
  else if inputstr='91F0' then
       RetTextFromStr := '该文件号不存在!'
  else if inputstr='919E' then
       RetTextFromStr := '参数无效!'
  else if inputstr='91BE' then
       RetTextFromStr := '试图读取/写入的数据超出文件/记录的边界!'
  else if inputstr='91A0' then
       RetTextFromStr := '请求的 AID 不存在!'
  else
  begin
       if midstr(inputstr,1,3)='63C' then
       begin
           i:=strtoint('$'+midstr(inputstr,3,1));
           if i>0 then
               RetTextFromStr :=  '再试 '+inttostr(i)+' 次错误密码将锁定!'
           else
               RetTextFromStr := '密码已被锁定!' ;
       end
       else
          RetTextFromStr:='未知的异常';
  end;
end;


举报

相关推荐

0 条评论