在delphi中如何定义一个压缩的字符串,比如说18本来是存在两个字节的,现在是存在一个字节?
或者,怎么压缩一个字符串?

解决方案 »

  1.   

    var
      s: packed string;是这个意思吗?
      

  2.   

    Instances of a structured type hold more than one value. Structured types include sets, arrays, records, and 
    files as well as class, class-reference, and interface types. Except for sets, which hold ordinal values only, structured types can contain other structured types; a type can have unlimited levels of structuring.
    By default, the values in a structured type are aligned on word or double-word boundaries for faster access. When you declare a structured type, you can include the reserved word packed to implement compressed data storage. For example,type TNumbers = packed array[1..100] of Real;Using packed slows data access and, in the case of a character array, affects type compatibility. For more information, see Memory management.我想意思是,packed只能用于结构类型,上面有例子。