Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > String processing - from hex to CW
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 22nd August 15:50
ivan brewis
External User
 
Posts: 1
Default String processing - from hex to CW



Hi

I have a string of octets (hexadecimal) eg. "CE370BA4" which is a string of
UCS2 encoded characters.
I'd like to convert this string to a clarion string.

I have looked at the string class from Jim Kane but I cannot see how I can
use it to convert my string of octets to a CW "string".

Can anyone help?

Thanks

Cheers
Ivan
  Reply With Quote


 


2 29th August 10:43
randy goodhew
External User
 
Posts: 1
Default String processing - from hex to CW



Use EVALUATE() - see the docs...

--
Randy Goodhew
---[ eQ ]---
  Reply With Quote


 


3 29th August 10:44
ivan brewis
External User
 
Posts: 1
Default String processing - from hex to CW


Hi Randy

Thanks for the reply, Evaluate performs expression evaluation - I'm not sure
how you are suggesting I use this to convert a 2 byte Unicode hexadecimal
string into a Clarion string?

Cheers
Ivan
  Reply With Quote
4 29th August 10:45
ole-morten heien
External User
 
Posts: 1
Default String processing - from hex to CW


Hi Ivan
Using Evaluate as Randy says is the right way:

loop i# = 1 to len(HexString) by 2
MyString = clip(MyString) & chr(evaluate('0' & HexString[i#,i#+1] &
'h'))
End!Loop

If the Evaluate cant handle the string manipulating, the evaluate on an
implicit:

CheckStr" = '0' & HexString[i#,i#+1] & 'h'
Evaluate(CheckStr") Will give you the converted Decimal

--
Ole-Morten Heien
HD Software
www.hdsoftware.no
Mail: o-m<RemoveToMailMe>heien@hdsoftware.no
ICQ: 72785878
MSN: spam@hdsoftware.no
  Reply With Quote
Reply


Thread Tools
Display Modes




666