I need to convert a string into a string of decimals

I need to convert a string into a string of decimals, 2 decimals per original character.  Alternatively to convert to a hex looking format 1-9 A-F.

Can anyone help?

Thanks in advance.
CRB1609Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
John TsioumprisConnect With a Mentor Software & Systems EngineerCommented:
if you change my above code to -30 instead of -50...it produces a rather nicely
448174800253797586740219272227 which is even,,,,
But in order to be safe and cover everything you should provide your own Mappings like :
A -->50
B -->62
C --77
 1 -->37
space -->98
I think this covers your needs...
0
 
Rgonzo1971Commented:
Hi,

Could you be more precise?

Regards
0
 
Gustav BrockCIOCommented:
Yes, many can help.
But your question is more like a guessing contest - nothing to work with.

/gustav
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
John TsioumprisSoftware & Systems EngineerCommented:
I guess what you need is to match a char to a pair of numbers (e.g for encryption)
Public Function TextToPair(InputString As String) As String
Dim tmpOutput As String
Dim strLen As Integer
Dim counter As Integer
strLen = Len(InputString)
For counter = 1 To strLen
tmpOutput = tmpOutput & Format(Asc(Mid(InputString, counter, 1)) - 50, "00")
Next
Debug.Print tmpOutput
TextToPair = tmpOutput
End Function

Open in new window

To test it
TextToPair("ALPHATest")

Open in new window

produces :
152630221534516566

Open in new window

From there you can play many tricks like inverting the output...addng or substracting a value (eg. +10)...the minus 50 is to catch the letters above 99...so "A" instead of 65 becomes 15...you can also define your own mappings
0
 
CRB1609Author Commented:
If I have a string like "John Smith 1949" I want to resolve each character to 2 digits 0-9 so that I end up with a string that might look something like "156042318542789582652545657528".

The purpose is to create a product registration key from the user name and unique member number.

The user registers the product by sending me the user name and number.

My registration program creates the key and sends it back.

The user enters the key into the registration screen in the program, which creates the same key from the information in the prgram, using the same logic.  If thekeys  match the program is registered.

Hope that helps.
0
 
akbCommented:
Really no point to doing that. That would be so easy to crack that you may as well not even bother. You really need to encrypt the key.
0
 
CRB1609Author Commented:
akb,
Thanks for the comment but I need a result that is numbers only.
0
 
CRB1609Author Commented:
Thanks, John.  Just what I needed.

Clive
0
All Courses

From novice to tech pro — start learning today.