Logging CMD output to Variable includes linefeed/newline

Hi There

I am dynamically getting build parameters via a command line application I made. These values are then logged to a variable in the FB project to then be used later. I found that these logged variables (strings) were being stored with linefeeds/newlines. This then breaks various other commands that use these variables.
I tried to do some research on this but have not found anything specifically discussing this behavior and how to stop it.
Am I missing an option somewhere? Is there a function I can use to remove the trailing linefeeds/newlines?

Any help would be appreciated.

The String Trimming action will remove trailing cr/lf’s if Trim Right or Trim Left/Right is selected. If you have trailing spaces you want to keep then you will need to use the Text Find/Replace action, set the search string to something like (this will remove leading and trailing line breaks).

^[\r\n]+|\.|[\r\n]+$

and check the “Match as regular expression” checkbox, on the Replace tab set to “Replace text and write back to variable” and leave the replacement string blank.

1 Like

Hi Vincent

Just tried that now and it works as required.

Thanks very much for the help.