Sujet : Re: Remove new line char
De : ralfixx (at) *nospam* gmx.de (Ralf Fassel)
Groupes : comp.lang.tclDate : 19. Mar 2025, 14:53:23
Autres entêtes
Message-ID : <ygav7s5i0to.fsf@akutech.de>
References : 1
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
*
alexandru.dadalau@meshparts.de (alexandru)
| 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?
First step would be to identify the offending char by printing it in hex
or octal. Depending on the result, regexp pattern "whitespace" might be
of help
regsub {[[:space:]]+$} $text ""
regsub {[\s]+$} $text ""
(cf
https://www.tcl-lang.org/man/tcl/TclCmd/re_syntax.htm)
HTH
R'