[fpc-pascal] represent data string in hex?

patspiper patspiper at gmail.com
Sat Sep 21 12:27:10 CEST 2013


On 21/09/13 12:15, wkitty42 at windstream.net wrote:
> On Friday, September 20, 2013 12:47 PM, Bart <bartjunk64 at gmail.com> wrote:
>> On 9/20/13, wkitty42 at windstream.net <wkitty42 at windstream.net> wrote:
>>   
>>> a[n] := #255;  // works
>>> a[n] := $ff;     // does not work
>>>
>>> ideally, there would be multiple bytes...
>>>
>>> a[n] := $C2AD  or  a[n] := $C2$AD
>>>
>>   
>> Not sure what you want:
>>   
>> a[n] := #$FF;  (which equals a[n] := #255)
>> a[n] := '$FF' (note the single quotes), assuming a[n] is of type String.
> yeah, the singles are bad examples... i'm really wanting the multiple byte format to work... i tried both and was told "expected string but found byte" or "word"... it is for a translation table... in quoted-printable, everything is equalsXX... the same codes are used in utf-8... so i thought if i could just copy them directly into my array and then change the equals to dollar...
>
> i ended up getting it to work by wrapping each piece with chr() but that's really ugly visually when looking at the code to see the side by side character and replacement tables...
>
> a[n] := chr($C2)+chr($AD) for two byte codes...
What about a[n] := #$C2#$AD?

Stephano



More information about the fpc-pascal mailing list