Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: remove question marks and exclamation points Date: Sat, 24 Jan 2015 13:39:45 -0500 Organization: A noiseless patient Spider Lines: 37 Message-ID: References: <68b0cd7e-0dff-4e0f-9007-34ed5fd3d08f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 24 Jan 2015 18:39:19 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="14099"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Px5iJxlQ5k/RvJLsbgvPk" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <68b0cd7e-0dff-4e0f-9007-34ed5fd3d08f@googlegroups.com> Cancel-Lock: sha1:ICGtUYI4d/kS1Qt6WzWuTn7DA/w= Xref: csiph.com comp.lang.java.programmer:30839 On 1/24/2015 12:21 PM, elodie.gillain@gmail.com wrote: > Hi everyone, > > I wrote code to remove question marks and exclamation points from some text. However, one can find those in my output file. Interesting enough, the periods (full stops) were removed. Can anybody help me figure this out? > [... code snipped; see up-thread ...] Consider what your code does with an input line like "What?" she exclaimed. "It wasn't his to begin with!" You'll get the "word" sequence "What?" she exclaimed. "It wasn't his to begin with!" ... from which you'll obtain What? she exclaimed It wasn't his to begin with! -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM