Fix unsafe string slicing in ShouldStartsWith/ShouldEndsWith.

This fixes a slice bounds panic whenever a shorter string is compared against a longer prefix/suffix.