Questions tagged [counting]

Questions about how to count the number of occurrences of something. Questions about the Vim feature that repeats commands should use the 'count' tag instead.

24 questions
1
vote
1 answer

How to get the number of occurrences of a certain character on the current line in Vim?

Using Vim 8. I want to count the number of pipe symbols that are on the current line so that I can compare it to the other lines in the file and make sure my pipe symbol count is consistent. How do I do this?
MrSnrub
  • 431
  • 3
  • 10
1
vote
0 answers

How can I count instances of character "x"?

Let's say I have the following bit of code: v = [0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0] I want to know how many elements are in v. My current solution, if v isn't too large, requires a bit of counting, but it makes for more readable code: v = [0,0,0,0, …
stvsmth
  • 111
  • 2
-1
votes
2 answers

Counting a character in items

I have this function : function MaFonction10() let myList1 = ["self-made-man", "rendez-vous", "forget-me-not"] for elem in myList1 echo len(elem) endfor endfunction I vould like to get the number of hyphens or letter "a"s…