Added exceptions to String class

Added exception throwing from certain functions in String class when
parameters are invalid