Hello
I want to convert text to hex using AL code. Is there any function that can do so?
I am working on cloud Business Central so I can't use any Dot Net library.
example:
Text Input = Bobs Records
Hex Result = 426F6273205265636F726473
Thanks
Hi
See this post forum.mibuso.com/.../how-to-convert-text-to-hexadecimal-in-nav-2005
specially the following by Duikmeester
OnRun() MESSAGE('0x%1',ConvertBase16('Hogan')); LOCAL ConvertBase16(theInput : Text[512]) theOutput : Text[1024] FOR aIndex := 1 TO STRLEN(theInput) DO BEGIN aInt := theInput[aIndex]; aLeft := ROUND(aInt / 16,1,'<'); aRight := aInt MOD 16; theOutput += HexValue(aLeft) + HexValue(aRight); END; LOCAL HexValue(theValue : Integer) : Text[1] CASE theValue OF 0..9: EXIT(FORMAT(theValue)); 10: EXIT('A'); 11: EXIT('B'); 12: EXIT('C'); 13: EXIT('D'); 14: EXIT('E'); 15: EXIT('F'); END;
it works. thank you
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Rishabh Kanaskar 4,327
Sumit Singh 2,734
Nimsara Jayathilaka. 2,599