?
Solved

howto embed hex in String?

Posted on 2011-09-07
4
Medium Priority
?
330 Views
Last Modified: 2012-05-12
I can't seem to find an answer on this ... how to I embed a hex value in a string? For example, I have the string "<%text" and I want [sic] "<\x25text" where \x25 would be my hex escape sequence ... except that doesn't work. What does?
0
Comment
Question by:jmarkfoley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 36500346
0
 
LVL 47

Expert Comment

by:for_yan
ID: 36500362
Or you can  use getNumericValue() of Character class
and then use toHexString() iof the Integer class
but which characters you want to transfiorm this way ?
0
 
LVL 36

Accepted Solution

by:
mccarl earned 2000 total points
ID: 36500395
You can't do hex escapes in string literals (only in character literals). However, you can use either octal escapes or unicode escapes. Therefore your strings would be either..

Octal: "<\045text"

or

Unicode: "<\u0025text"
0
 
LVL 1

Author Closing Comment

by:jmarkfoley
ID: 36500469
That did the trick! Thanks!
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question