• SOA Guy
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 4
    Replies

In order to integrate with a legacy system from Salesforce, I need to generate a digest in a certain way. Luckily the methods in the Crypto class get me 99% there, but for one step of the process I need to convert the characters in a string into their ASCII code values in order to do some math with the results.  

The problem is that I can't find a simple way to do this in APEX. Conversions between strings and integers don't appear to do what I need as they would in most other languages.  I can use the convertToHex method in EncodingUtils to get the hex value for a string, but the result is yet another string  and the Integer class valueOf doesn't accept a number base.  In the worse case, I can write the conversion of a hex string to an integer myself, but I want to be sure there's not another answer.

I know this a rather low-level task for APEX. Any suggestions?  

  • March 26, 2008
  • Like
  • 0