The initial value of ``charAtCurPosition`` is undefined.

Also, you probably want to handle more separators, like tab, newlines, etc.