Last one, just print (in fact uses it to do some stuff)

Thanks a Lot Tim and if you have time I will be glad to ask for your
help about sql command

On 20 nov, 18:22, Tim Chase <[email protected]> wrote:
> > I want to count all ; present at the beginning of a line.
>
> > ;;;sentence;    => should give 3 and not 4
> > ;;sentence;    => should give 2 and not 4
> > ;sentence;    => should give 1 and not 4
>
> Then depending on what you want to do with that count (put it at
> the beginning of each line, or print it for one line), the two I
> gave should work:
>
> >>    :%s/^;*/\=strlen(0).' '.submatch(0)
>
> >> which will count just the ";" at the beginning of the line and
> >> put that count there.  If you need the count in a variable
> >> instead of on the line, you could do something like
>
> >>    :echo strlen(matchstr(getline('.'), '^;*'))
>
> -tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to