fix issue #11

use a variable to hold the starting position of a string
Merge pull request #12 from ytsTony/master

fix issue #11