help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Converting strings of hexadecimal numbers to the respective bytes


From: Juanma Barranquero
Subject: Re: Converting strings of hexadecimal numbers to the respective bytes
Date: Tue, 7 Apr 2009 00:54:16 +0200

On Tue, Apr 7, 2009 at 00:22, florian <lorian@fsavigny.de> wrote:

> What I mean is: if it were a three-digit decimal representation, you
> could say
>
>   (char-to-string (string-to-number "010"))
>
> instead, but I don't seem to see such a possibility for a hexadecimal
> number.

  (string-to-number string &optional base)

  Parse string as a decimal number and return the number.
  This parses both integers and floating point numbers.
  It ignores leading spaces and tabs.

  If base, interpret string as a number in that base.  If base isn't
  present, base 10 is used.  base must be between 2 and 16 (inclusive).
  If the base used is not 10, floating point is not recognized.

so

  (char-to-string (string-to-number "0a" 16)) => "\n"

    Juanma




reply via email to

[Prev in Thread] Current Thread [Next in Thread]