Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6853243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:29:20+00:00 2026-05-27T01:29:20+00:00

I am using Delphi 2010 and I have a need to be able to

  • 0

I am using Delphi 2010 and I have a need to be able to convert a string to a hexadecimal string, and then later be able to convert that hexadecimal string back to the original unicode string.

For example, my string is: Михаи́л Васи́льевич Ломоно́сов

I was able to use Warren P’s StringToHex16 snippet here (and I pasted Warren’s snippet below) to convert the string to a hex string, but I don’t know how to convert that hex string back to the original unicode string.

function StringToHex16(str: string): string;
var
   i:integer;
   s:string;
begin
       s:='';

       for i:=1 to length(str) do begin
           s:=s+inttohex(Integer(str[i]),4);
       end;
       result:=s;

end;

Using the linked StringToHex16 gives me this hex string:

041C04380445043004380301043B002004120430044104380301043B044C04350432043804470020041B043E043C043E043D043E03010441043E0432

I am a bit naive with this topic and I would appreciate any help you can provide to convert this hex string back to the original input.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:29:20+00:00Added an answer on May 27, 2026 at 1:29 am

    The linked function produces four hexadecimal digits for each character in the input string, so your inverse function needs to take blocks of four characters and convert them into one. The function used IntToHex to convert the numeric character codes of the input string into the output characters, and the inverse of IntToHex is StrToInt with the hex prefix, so let’s use that.

    function HexToString16(const str: string): string;
    var
      i: Integer;
      code: string;
    begin
      Result := '';
      i := 1;
      while i < Length(str) do begin
        code := Copy(str, i, 4);
        Result := Result + Chr(StrToInt('$' + code));
        Inc(i, 4);
      end;
    end;
    

    This function assumes the input was generated by StringToHex16 or something equivalent. If it doesn’t consist of a multiple of four hexadecimal digits, behavior is undefined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Delphi 2010 with Tim Anderson's SQLite wrapper (unicode version) Have a
I have started using of generics in Delphi 2010 but I have a problem
I need to read from and write to Excel spreadsheets using Delphi 2010. Nothing
I am using Delphi 7 but I have trialed the Delphi 2005 - 2010
I'm using Delphi 2010, and I need to run a console application and automate
I'm using the line below to have MSBuild build a Delphi 2010 groupproj: MSBuild
I'm using Delphi 2010 and I have a TToolButton contained by a TToolBar. Assigned
I am using Delphi 2010. I have to set UseLatestCommonDialogs to False and additionally
Using Delphi 2010... I have a set of binary properties I want to group
My application is written using : Embarcadero Delphi 2010 I have a form named

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.