Solved

howto embed hex in String?

Posted on 2011-09-07
4
326 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 500 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
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 …

707 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