Get rid of null character in vim variable?
Some alternatives:
Remove the
\n
usingsubstitute(string, '\n$', '', '')
See:h NL-used-for-Nul
for the technical backgroundRemove all control chars:
substitute(string, '[[:cntrl:]]', '', 'g')
Compare using the match (
=~
) operation instead of equal (==
)Strip away the last byte of the output from the system() command
:let a=system('foobar')[:-2]