How to count spaces in text?

In the following example, there are 4 spaces before inet.

wolf@linux:~$ ip address show eth0 | grep 'inet '
    inet 10.10.10.10/24 brd 10.10.10.255 scope global dynamic eth0
wolf@linux:~$ 

How do I count the number of spaces like this example.

This sample is easy as it only has 4 spaces.

What if it has more than that? Hundreds, thousands?

Is there an easy way to do this?

Go to Source
Author: Wolf