Trimming newlines from a string

Alex Caudill erudified at gmail.com
Tue Mar 21 22:48:51 CET 2006


On 3/21/06, Pino Toscano <toscano.pino at tiscali.it> wrote:
> Hello,
>
> finally, I'm subscribed too! :)
>
> First mail, first question: imagine I have a string made by a newline
> character only, ie the line
> message(STATUS "myvar: \"${myvar}\"")
> would output
> -- Found ...
> -- myvar: "
> "
> -- Found ...
> Doing a
> STRING(REGEX REPLACE "\\n?\\r?" "" myvar "${myvar}")
> have the result to make cmake output that the regexp matches an empty string.
>
> Do you have any precious suggestion about sometimg that I'm missing?
>
> Regards,
>
> --
> Pino Toscano
>
That approach looks fine to me.


More information about the Kde-buildsystem mailing list