
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Convert from ASCII Text to HEX
I'm lookng for some help converting ASCII text to hex, I would like to do it in a tMap if possible.
Here is an example of my text string:
;7627
And here is the Hex equivalent:
3B37363237
Thanks for any help...
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do this by creating a routine and calling the relevant method from that routine in the tMap. I had a quick Google to see if anyone had already written code for this and found this code....
String ascii = ";7627";
// Step-1 - Convert ASCII string to char array
char[] ch = ascii.toCharArray();
// Step-2 Iterate over char array and cast each element to Integer.
StringBuilder builder = new StringBuilder();
for (char c : ch) {
int i = (int) c;
// Step-3 Convert integer value to hex using toHexString() method.
builder.append(Integer.toHexString(i).toUpperCase());
}
System.out.println("ASCII = " + ascii);
System.out.println("Hex = " + builder.toString());
..... here....
https://www.boraji.com/how-to-convert-ascii-to-hex-in-java

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do this by creating a routine and calling the relevant method from that routine in the tMap. I had a quick Google to see if anyone had already written code for this and found this code....
String ascii = ";7627";
// Step-1 - Convert ASCII string to char array
char[] ch = ascii.toCharArray();
// Step-2 Iterate over char array and cast each element to Integer.
StringBuilder builder = new StringBuilder();
for (char c : ch) {
int i = (int) c;
// Step-3 Convert integer value to hex using toHexString() method.
builder.append(Integer.toHexString(i).toUpperCase());
}
System.out.println("ASCII = " + ascii);
System.out.println("Hex = " + builder.toString());
..... here....
https://www.boraji.com/how-to-convert-ascii-to-hex-in-java
