Friday, February 14, 2014

Re: Trimming newlines from calls to system()

On Fri, Feb 14, 2014 at 2:17 PM, ZyX <zyx.vim@gmail.com> wrote:

Usually if you know for sure that command will output trailing newline (which you do in something like 90% of cases) you just use `system()[:-2]`. `substitute(system(), "\n*$", '', '')` if you want to trim any amount of newlines (like `str.rstrip('\n')` in python).

 Thanks. Am I correct, however, in thinking that the first method assumes Python support in the Vim instance? (See http://vim.1045645.n5.nabble.com/String-manipulation-in-vim-scripts-tp1169327p1169330.html.)

Ben

--
b

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
 
---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: