//Date: 2019-06-03 //Parm: 以空格分隔的十六进制字符串 //Desc: 使用nHex构建字符串 class function TStringHelper.ByHex(const nHex: string): string; const cChars = [#32, #13, #10]; //spit char var nStr: string; nIdx,nHi,nPos: Integer; begin Result := ''; nHi := High(nHex); if nHi < cFI then Exit;
nPos := cFI; for nIdx:=cFI to nHi do begin if not CharInSet(nHex[nIdx], ['0'..'9','a'..'f', 'A'..'F'] + cChars) then begin nPos := nIdx + 1; Continue; end;
if CharInSet(nHex[nIdx], cChars) or (nIdx = nHi) then begin if not CharInSet(nHex[nPos], cChars) then begin if CharInSet(nHex[nIdx], cChars) then nStr := Copy(nHex, nPos, nIdx - nPos) else nStr := Copy(nHex, nPos, nIdx - nPos + 1);
if Length(nStr) = 2 then Result := Result + Char(StrToInt('$' + nStr)); //xxxxx end;
nPos := nIdx; end else begin if CharInSet(nHex[nPos], cChars) then nPos := nIdx; //xxxxx end; end; end;
----------------------------------------------
生活愉快.
http://dl.downloadly.ir/Files/Software2/nrCommLib_Pro_9.48_Delphi_10.3_Rio_Full_Source_Downloadly.ir.rar
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3