• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ascii to hex converter

 
Ghaith Shamayleh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like if there is a function in java that can be used to covert a string of ascii to a string of hex, or should i write a method to write this, can anyway help
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This one does it one character at a time; I'm actually cramming unicode into byte, but if you have ASCII (in 7 or 8 bits), it will cast to byte as well.

Look up details for formatting string output under java.util.Formatter

rc>
 
Ghaith Shamayleh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this will take a string of hex and convert it or a string of ascii and covert it
 
Campbell Ritchie
Sheriff
Posts: 51332
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is a String of hex? Do you mean a String which only contains the characters 0-9 a-f and A-F? Your last comment appears to want the opposite of what the thread title says you want.
 
Ghaith Shamayleh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got it cheers everyone
 
Campbell Ritchie
Sheriff
Posts: 51332
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic