From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.help Subject: Re: reduce repeated backslashes Date: Mon, 15 Feb 2010 10:12:12 +0100 Organization: ThierryVolpiatto Message-ID: <87r5omj21f.fsf@tux.homenetwork> References: <4B79086D.7040604@online.de> <87vddyj2ew.fsf@tux.homenetwork> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1266225460 18461 80.91.229.12 (15 Feb 2010 09:17:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Feb 2010 09:17:40 +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 Feb 15 10:17:38 2010 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.69) (envelope-from ) id 1Ngx5E-0003aE-8H for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Feb 2010 10:17:36 +0100 Original-Received: from localhost ([127.0.0.1]:40053 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ngx5D-0003UR-6K for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Feb 2010 04:17:35 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ngx4l-0003Sx-HV for help-gnu-emacs@gnu.org; Mon, 15 Feb 2010 04:17:07 -0500 Original-Received: from [140.186.70.92] (port=46245 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ngx4k-0003Sj-Ix for help-gnu-emacs@gnu.org; Mon, 15 Feb 2010 04:17:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ngx4j-00050s-U4 for help-gnu-emacs@gnu.org; Mon, 15 Feb 2010 04:17:06 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:48585) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ngx4j-00050i-KO for help-gnu-emacs@gnu.org; Mon, 15 Feb 2010 04:17:05 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ngx4i-0003Ij-JY for help-gnu-emacs@gnu.org; Mon, 15 Feb 2010 10:17:04 +0100 Original-Received: from 35.78.88-79.rev.gaoland.net ([79.88.78.35]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Feb 2010 10:17:04 +0100 Original-Received: from thierry.volpiatto by 35.78.88-79.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Feb 2010 10:17:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 35.78.88-79.rev.gaoland.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAElBMVEUHBARgJRFPS0WbMBTC TSG/uJs0yyVHAAAACXBIWXMAAAsSAAALEgHS3X78AAAACXZwQWcAAAAwAAAAMADO7oxXAAABpUlE QVQ4y3VTQXKDMAyUnD7AwvQOhtxj5N4LFh9ow/+/UtlpM0BczWSS0Wola7UBeEb3+3kJ/5p9ZLz3 UI0n0J0Y4K/lh1nG24FhlJOR2LdSKtpV5gfi/Zd+NdaJBbB4D5N0JnfUIVp6obZURkJwS2a8b9uX AkgxA5gCEcknAH1s2z0DPooWmjGKcJR+HNZt+9bm0GtGRycRuZGs98Ffr02vABWGopIAhmXmxnQN BwBXZjgFLHRoqbfeYxCLWqsjLyKhbEHW+A5nEs699Q2O80ALrgHTmUTy6P0MnKyKQpKHpoNWokxs F0D5VegvWmEozyE6nuMiS98mWzlUQ9bW8qYfqOaFtzWlYCqGeIs6HEyl08jkrxUG9MF5ipXpOOpd ZMoXPPVSLWJiiwNNB+eRSyxJZmQKcacikgucnCRiHuJOLmyYJRDPwOqAvY4pA+Wy+VS8G26BAsdb Ph2Hw7ORy/H0IOG0TnaM8Cp0XrFYyU0v2z8AqkifPVbLZ0qo/gsRg60C7p+8Ov9jrUIxFde+jnAq X42hyp/c+ZcnVyUYBarrqZt3+R8450png3cWKgAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAwOC0wNS0z MVQyMjoxNDoyMiswMjowMK3VBDcAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMDctMTAtMjhUMTc6MDg6 NDgrMDE6MDDLdIcLAAAAEXRFWHRqcGVnOmNvbG9yc3BhY2UAMix1VZ8AAAAgdEVYdGpwZWc6c2Ft cGxpbmctZmFjdG9yADJ4MiwxeDEsMXgxSfqmtAAAAABJRU5ErkJggg== User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.92 (gnu/linux) Cancel-Lock: sha1:HGQb0KaX0goomBcac0y1xNfeCTU= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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:71868 Archived-At: Thierry Volpiatto writes: > Andreas Roehler writes: > >> Hi, >> >> don't know how to replace/reduce repeated backslashes >> from inside a string. >> >> Let's assume "abcdef\\\\" >> >> Tried >> >> (replace-regexp-in-string "\\\\" (number-to-string ?\\) "abcdef\\\\" nil t) >> >> which reduces so far, but shows chars as it's numeric value: >> >> --> "abcdef9292" >> >> Any help? Thanks! > > What result do you expect? > > `number-to-string' give the string value of a number: > > eval: > ?\\ ==> 92 > (number-to-string ?\\) ==> "92" > > `string' will give you the real value of ?char: > eval: > (string ?\\) ==> "\\" > > May be a better approach is:(if it is what you expect) > > (substring "abcdef\\\\" 0 7) > "abcdef\\" However: (replace-regexp-in-string "\\\\\\\\" (string ?\\) "abcdef\\\\" nil t) ==> "abcde\\" -- Thierry Volpiatto