String.first and String.last return IndexOutOfRangeException when applied to empty strings. It would be better to instead check for empty strings and throw an explicit error message.
Repro steps
Please provide the steps required to reproduce the problem
Description
String.first
andString.last
returnIndexOutOfRangeException
when applied to empty strings. It would be better to instead check for empty strings and throw an explicit error message.Repro steps
Please provide the steps required to reproduce the problem
Expected behavior
Proper error message.
Actual behavior
System.IndexOutOfRangeException
.