Renamed SafeSubstring param and supporting logic

SafeSubstring was incorrectly passing "length" as "startIndex".
Added tests for SafeSubstring

Added tests to validate the index and length parameters of the underlying Substring.
Merge pull request #415 from jerbri/patch-2

Renamed SafeSubstring param and supporting logic - v3