Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Simon Geard Newsgroups: comp.lang.tcl Subject: Re: Remove new line char Date: Thu, 20 Mar 2025 10:07:35 +0000 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: <99c3a67de883d847a088f8158aea9998@www.novabbs.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 20 Mar 2025 11:07:35 +0100 (CET) Injection-Info: dont-email.me; posting-host="f99449c08998058b49661713dfa9edcc"; logging-data="3149035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KNcotSsnnMnN6xk8JKgEQ" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:lH9bIlt7nlGyC8QDJ801x1Ud/L4= Content-Language: en-GB In-Reply-To: <99c3a67de883d847a088f8158aea9998@www.novabbs.com> Bytes: 1723 On 19/03/2025 11:47, alexandru wrote: > I'm accessing the Windows clipboard using twapi. > When the text in the clipboard was copied from an MS Excel cell, then > text contains some new line char that I could not identify and thus > unable to remove it using > > regsub {[\r\n]+$} $text "" > > What other way are there besides "string trim" to remove new line chars? > > Many thanks > Alexandru > > -- Could this be an encoding issue? I remember that the default output from a Powershell is UTF-16 LE so maybe that's true of Excel (which I don't have so can't test). Another thought is to create a list split on the unwanted newline character then reassemble it. Simon