ASCII to CHAR
Author: dennis.vorst@uniface.com (Dennis Vorst)
Hi Is there a way in Uniface to convert a number to its ASCII equivalent? For instance 65 into the capital A. And vice versa.
Author: dennis.vorst@uniface.com (Dennis Vorst)
Hi Is there a way in Uniface to convert a number to its ASCII equivalent? For instance 65 into the capital A. And vice versa.
Author: dennis.vorst@uniface.com (Dennis Vorst)
Hi Is there a way in Uniface to convert a number to its ASCII equivalent? For instance 65 into the capital A. And vice versa.
For ASCII value to character you can use $string Can't type the syntax here because it gets translated by the forum software so please look it up in the uLibrary.
Author: dennis.vorst@uniface.com (Dennis Vorst)
Hi Is there a way in Uniface to convert a number to its ASCII equivalent? For instance 65 into the capital A. And vice versa.
You could also use $encode/$decode - although then you'll deal with HEX values (e.g. 65 = 0x41).
In case you need a numeric value then you additionally have to write a little conversion routine for numeric to HEX and HEX to numeric.
Author: dennis.vorst@uniface.com (Dennis Vorst)
Hi Is there a way in Uniface to convert a number to its ASCII equivalent? For instance 65 into the capital A. And vice versa.
Hello, There is also the undocumented function $tometa().
A = $tometa(65)
Author: dennis.vorst@uniface.com (Dennis Vorst)
Hi Is there a way in Uniface to convert a number to its ASCII equivalent? For instance 65 into the capital A. And vice versa.
diseli said You could also use $encode/$decode - although then you'll deal with HEX values (e.g. 65 = 0x41).
- HEX to CHAR: $encode("USTRING", $decode("HEX", "41")) => "A" ; please note that $decode will return RAW data and we therfore have to convert it to a string using $encode("USTRING")
In case you need a numeric value then you additionally have to write a little conversion routine for numeric to HEX and HEX to numeric.
- CHAR to HEX: $encode("HEX", "A") => "41"
Just a quick note: $encode/$decode will only only work with UTF-8 - the output of $decode is UTF-8 and the input of $encode is treated as UTF-8.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.