I was trying to use long paragraph text but somehow Nix adds newline, anyway to avoid it?
Example:
let longText =
''
This is first line with long text.
This is continuation of first line with long text.
This still need to be continued in one line with long text.
'';
in
"${longText}"
Actual Output:
“This is first line with long text. \nThis is continuation of first line with long text. \nThis still need to be continued in one line with long text. \n”
Expected Output:
“This is first line with long text. This is continuation of first line with long text. This still need to be continued in one line with long text.”
Thanks @NobbZ for your quick response. I am aware about not using newline in string. For my case its will be huge text and for better file readability any special character that I can use to mark text continuation and don’t add extra newline?
In that case using lib.concatStrings is probably your best bet:
let longText = lib.concatStrings [
"This is first line with long text. "
"This is continuation of first line with long text. "
"This still need to be continued in one line with long text. ";
];
in "${longText}"
There is also lib.concatStringsSep which you can use to “inject” the interleaving space ().