zoukankan      html  css  js  c++  java
  • 十六进制数相加校验和计算程序

    {-------------------------------------------------------------------------------
      过程名:    16进制数相加效验和程序
      作者:      陈新光
      日期:      2008.07.24
      参数:      AStr: string; AIndex: Integer(从第几个字符开始计算)
      返回值:    string
    -------------------------------------------------------------------------------}
    function GetCheckStr(AStr: string; AIndex: Integer): string;
    var
      newstr1,he,oldstr:string;
      tj:boolean;
      i:integer;
    begin
       i:=1;
       he:='';
       tj:=true;
      oldstr:=copy(AStr,AIndex,length(AStr)-AIndex+1);
      while tj=true do
        begin
          newstr1:=copy(oldstr,i,2);
          oldstr:=copy(oldstr,i+2,length(oldstr)-2);
          //开始计算校验和并给he变量
          if he='' then
            begin
              he:=inttohex(strtointdef('$'+newstr1,16)+ strtointdef('$'+'00',16),2);
              he:=rightstr(he,2);
            end
          else
            begin
              he:=inttohex(strtointdef('$'+newstr1,16)+ strtointdef('$'+he,16),2);
              he:=rightstr(he,2);
            end;
          if  length(oldstr) =0 then tj:=false;
        end;
      Result:= AStr+he;
    end;
  • 相关阅读:
    axios解决调用后端接口跨域问题
    vuex的使用入门-官方用例
    vue使用axios实现前后端通信
    vue组件间通信用例
    vue-router的访问权限管理
    vue-router使用入门
    PHP 流程控制
    PHP 表达式和运算符
    PHP 预定义变量
    PHP 常量
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/2940846.html
Copyright © 2011-2022 走看看