From: Karl Faller on
Oh boy,

FUNC HexString2String(cHex AS STRING) AS STRING
LOCAL cRes AS STRING
LOCAL i, nVal AS INT
IF SLen(cHex) >=2
FOR i := 1 UPTO SLen(cHex)-2 STEP 3
nVal := 16*Val(SubStr3(cHex,i,1))+Val(SubStr3(cHex,i+1,1))
? cRes += CHR(nVal)
NEXT
ELSE
cRes := ""
? "Param invalid"
ENDIF
RETURN cRes

But better probably:
FUNC HexString2String(cHex AS STRING) AS STRING
RETURN Hex2C(StrTran(cHex, " ", ""))

enough...

Karl
From: Stephen Quinn on
Karl

> my sdk has no such func.

IIRC it's in VO25Lib, either that or I converted a Clipper function 10+
years ago<g>

CYA
Steve


From: Rob Smith on
On Jan 17, 8:54 pm, Karl Faller <k.faller_withoutth...(a)onlinehome.de>
wrote:
> Oh boy,
>
> FUNC HexString2String(cHex AS STRING) AS STRING
> LOCAL cRes  AS STRING
> LOCAL i, nVal AS INT
> IF SLen(cHex) >=2
>         FOR i := 1 UPTO SLen(cHex)-2 STEP 3
>         nVal := 16*Val(SubStr3(cHex,i,1))+Val(SubStr3(cHex,i+1,1))
>          ? cRes += CHR(nVal)
>         NEXT
> ELSE
>  cRes := ""
> ? "Param invalid"
> ENDIF
> RETURN cRes
>
> But better probably:
> FUNC HexString2String(cHex AS STRING) AS STRING
> RETURN Hex2C(StrTran(cHex, " ", ""))
>
> enough...
>
> Karl

Brilliant, many thanks that HexString2String work fine.
From: Jack Konings on
Just wondering.

Hex2C() is not documented in the Help file.
Did GrafX just forget it to document or is it a unsupported function (and
shouldn't be used) ?

How do you guys find out about this stuff (did it used to be a clipper
function) ?

Greetings,
Jack


"Karl Faller" <k.faller_withoutthat_(a)onlinehome.de> wrote in message
news:dit6l5d0d28peam6l3mckgeftuo7epeksn(a)4ax.com...
>>Hex2Bin()
> Hex2C() does it. But beware: feeded directly with the result of
> AsHexString() it produces garbage, as the blanks aren't removed...
>
> Karl
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4783 (20100118) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
From: Karl Faller on
Jack,
>How do you guys find out about this stuff (did it used to be a clipper
>function) ?
make a repo and import the sdk files - there are many, many goodies
hidden ;-)

Karl

First  |  Prev  | 
Pages: 1 2
Prev: VO28.8 big annoyance
Next: Constant