Added some defensive code to generateSubstring

Now if a user specifies a startposition less than 0, the function will
execute as if the user specified its startposition should be zero. The
same goes for how many spaces the function should copy. If the user
specified the function should copy for a number of spaces less than 0,
the function will create a substring 0 spaces in length (empty).