epanda schrieb:
> On 20 nov, 18:46, Andy Wokula <[email protected]> wrote:
>> epanda schrieb:
>>
>>> Hi,
>>> I would like to count number of character ; I have at the beginning of
>>> a line like that :
>>> ;;foo;bar;;
>>> I want a count = 2 but this command returns 5.
>>> :.s/;/&/gn
>> :s/\%(^;*\)\@<=;//gn
>
> Andy, is it faster than strlen(matchstr(getline('.'), '^;*'))     ?

No, I guess.  You can check this with TIMEIT
http://vim.sf.net/scripts/script.php?script_id=1622

A little shorter than
    strlen(matchstr(getline('.'), '^;*'))
is
    match(getline('.'), '^;*\zs')

-- 
Andy

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

Reply via email to