On 2 Apr, 17:14, Maxim Kim <haba...@gmail.com> wrote:
> On 2 апр, 19:34, Spiros Bousbouras <spi...@gmail.com> wrote:
>
> > let s = 'qwerty'
> > Let's say I want to replace the first character by Q. I thought
> > the following would work
> > let s[0] = 'Q'   but it gives
> > E689: Can only index a List or Dictionary
> > So what is the simplest way to achieve such a task ?
> ...
> > Anyone got a better idea ?
>
> let s='qwerty'
> let s='Q'.s[1:]

That's much better. You can even do echo s[-3:-1] which
gives rty. I wonder what is the purpose of the strpart()
function when such a convenient notation exists.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to