From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: How do I convert hex numbers to decimal ? Date: Mon, 07 Sep 2009 09:38:32 +0300 Organization: A noiseless patient Spider Message-ID: <871vmjp8d3.fsf@iki.fi> References: <1bfadfca-66ba-4aec-bb90-eb3a460c660c@l13g2000yqb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1252305752 13931 80.91.229.12 (7 Sep 2009 06:42:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Sep 2009 06:42:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 07 08:42:25 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MkXvk-0003oj-EY for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Sep 2009 08:42:24 +0200 Original-Received: from localhost ([127.0.0.1]:54758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MkXvj-00088p-Hi for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Sep 2009 02:42:23 -0400 Original-Path: news.stanford.edu!usenet.stanford.edu!postnews.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!feeder.erje.net!feeder.eternal-september.org!eternal-september.org!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 35 Original-X-Trace: news.eternal-september.org U2FsdGVkX1/KHpsKGZz+r/XtSJDe2gUU/40OsXhIpQ1FMKsK9P+Cr8rHtwogHSFZ3Xc2xcw9r6q4BgDwyKN9o+IzCQNo2sl6jDJYpKNA2qGYIAJg5RM52NmvECNRw6COuzxMqyUBbSnmbVizJgB2pg== Original-X-Complaints-To: abuse@eternal-september.org Original-NNTP-Posting-Date: Mon, 7 Sep 2009 06:38:32 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19gqxwZpD0b2Q7F0FcLWe9nyAlOLkyf6TsIXVQcHCit6w== Cancel-Lock: sha1:L4CQPQiEEgKfngGe+ro0z7Y9/NI= sha1:8ApwqFDRlrvUDIu/ZutpSSwYfZY= User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Original-Xref: news.stanford.edu gnu.emacs.help:172787 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67924 Archived-At: On 2009-09-06 22:52 (-0700), bolega wrote: > What I want is a function like this: > > (function "%1F) Where that "%" comes from? Do you want your function to require it? Here's an example: (defun my-hex-to-int (hexstring) (car (read-from-string (replace-regexp-in-string "\\`%" "#x" hexstring)))) (my-hex-to-int "%1F") => 31 Or without the % prefix: (defun my-hex-to-int2 (hexstring) (car (read-from-string (concat "#x" hexstring)))) (my-hex-to-int2 "1F") => 31 > what I want is a function like this: > > (function "%3F") and it converts it and returns or > prints ? either an existing facility or combination thereof. Do you mean like this? (format "%c" (my-hex-to-int "%3F")) => "?" It returns a string containing that character.