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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulating Strings

Status
Not open for further replies.

tehCoosh

Technical User
Aug 29, 2005
9
US
First off, I want to say thank you to everyone on this fourm. You've all been so helpful in the past :)

My problem:
I want to take a string and convert it to hex. Then I want take each hex value and convert it to a different hex value. Lets say character one = 70, change it to 73.

Example:
String = Hello
Convert String to Hex which is: 48 65 6c 6c 6f
Take each hex value and change it to a different value.
48 -> 52
65 -> 55
etc.
After that, combine the hex values back into 1 string.

Thanks in advance
 
Edit:
Couldnt find an edit button :-/

I want each hex value, to have a set hex value to convert to.
Example:
Hex value is 48
When converting, program looks up what value to change 48 into (such as 49) then converts it to that.
 
It looks as if you may be trying to obfuscate a text string - if so do a search on this forum for 'cryptoapi' where you may find better text encryption solutions.

Otherwise look at Mid$, Chr$ and Asc functions

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Ok I have my problem solved, last question.

How to I convert an ascii value (long) to a string? Ive searched msdn and couldnt find my answer.
 
An ASCII value is an Int. If you're seeing a Long it may be a Unicode character. If so have a look at the ChrW function.

There are some guidelines on forum usage at faq222-2244 which include some pointers for your basic research, which you may find helpful

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top