Using indexOf after reading a file, How would one code indexOf for only specific characters before and after a word? 

for example 

'billy'

Single Quotes: 2

bi'lly

Single Quotes: 0

My Code

```
if ( 0 <= name.indexOf("'")){
        singleQuotes++;

```

My code will count all of the single quotes, How can I make it so when it reads a file with a bunch of words. To only get the single quotes at the beginning and end of each word?