Hi Spiros!

On Do, 02 Apr 2009, Spiros Bousbouras 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 ? I know

let s=substitute(s,'^.','Q', '')

or in your case tr() may be even simpler:

let s=tr(s,'q','Q')

or you could use strpart:

let s='Q'.strpart(s,1)

regards,
Christian
-- 
hundred-and-one symptoms of being an internet addict:
178. You look for an icon to double-click to open your bedroom window.

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

Reply via email to