Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASCII-HEX Translation 1

Status
Not open for further replies.

warlow

Technical User
Feb 18, 2004
7
GB

Is there any straightforward way for Aspect to convert ASCII-HEX into ASCII? For example the remote end might send a message in the format:

Message1$4142432048454C4C4F203132330D0A

Which should be displayed as:

Message1 ABC HELLO 123

It is clear how to translate the opposite way but this direction is less obvious. Any clues are appreciated.
 
Here is something that might help.

Ignore the bad programming.

Proc Main
String temp1 =""
string input= "Message1$4142432048454C4C4F203132330D0A"
integer loop = 0
integer Output = 0
integer pos1= 0
integer pos2= 0

strfind input "$" pos1
strlen input pos2

pos1++

while pos1 <= pos2

Substr temp1 input pos1 2

usermsg &quot;%s&quot; temp1


Strtonum temp1 output 16

pos1 =pos1+2

usermsg &quot;This is the conversion :%c&quot; Output
endwhile



Endproc
 
Yes, this is a more elegant method than the indexed string approach I was considering.

I bow in deference to the greater wisdom shown by GPT/Plessey fans!

Many thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top