And the winner is ....... (drum roll) ....... DAVID WINSEMIUS!!!

Thank you hugely David.  You have completely solved my problem.
The last bit with format.hexmode() so as to get "00A3" rather than
just "a3" was actually unnecessary; I could've lived with "a3". But it was a nice bit of polish.

How you manage to find the relevant functions in the bewildering (to me) superabundance of functions is impressive as well as astonishing.

Thanks again.

cheers,

Rolf

On 05/02/14 19:07, David Winsemius wrote:

On Feb 4, 2014, at 8:56 PM, David Winsemius wrote:


On Feb 4, 2014, at 4:57 PM, Rolf Turner wrote:



If I have a character such as "£" stored in a object called "xxx", how can I obtain the 
hex code representation of this character?  In this case I know that the hex code is "\u00A3", but 
if I didn't, how would I find out?

I would like a function "foo()" such that foo(xxx) would return, say, the string 
"00A3".


Close:

as.hexmode(utf8ToInt("£"))
[1] "a3"


Looking at the help page again I realized that there was a `format.hexmode` to 
deliver as requested:

format(as.hexmode(utf8ToInt("£")), width=4, upper=TRUE)
[1] "00A3"


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to