Miloš Stanić
Miloš Stanić

Reputation: 520

How to count found strings in Visual Studio Code

When you search for a string in Visual Studio Code with Ctrl-F it doesn't display number of occurrences.

Is it possible to find out somehow?

On the other hand it displays a number of hits next to a filename when you search all files with Ctrl-Shift-F.

Upvotes: 18

Views: 20051

Answers (4)

banikr
banikr

Reputation: 75

click the down faced triangle and then choose 'find all'

enter image description here

and then the matched string number should be visible on the bottom left: enter image description here

Upvotes: 1

WeeBee
WeeBee

Reputation: 21

On Windows, you can count string occurrences with the command FIND /C "string you're searching" filename.txt

So on VSCode, you can open the console (ctrl + ') and type the command. It's one workaround to count string on large files without have to install any new extensions.

Upvotes: 1

RedJohn
RedJohn

Reputation: 374

I had the same problem as csonuryilmaz mentioned in the comment to this answer, I needed the exact count of the string, even if it is 19999+. I ended up opening the file in Notepad++, there you can count all occurences when searching for a string.

Maybe not the best solution if you want/have to use only Visual Studio Code, but for my problem this was a good enough workaround.

Upvotes: 20

hxlnt
hxlnt

Reputation: 636

Once you have the search bar pulled up with Ctrl-F, click the triangle on the left side of the search bar. The occurrence count of your search term will be displayed.

Happy coding!

Upvotes: 15

Related Questions