应用场景 Delphi中十六进制是$,而C语言中十六进制为0x,都支持删除。 函数代码 function StripHexPrefix(const HexStr: string): string; begin if Pos('$', HexStr) = 1 then Result := Copy(HexStr, 2, Length(HexStr) - 1) else if Pos('0x', LowerCase(HexStr)) = 1 then Result := Copy(HexStr, 3, Length(HexStr) - 2) else Result := HexStr; end;