Index and length must refer to a location within the string.
Parameter name: length
Watch solution on YouTube
To fix it replace
string test = "abc";
test = test.Substring(0, 5);
with
string test = "abc";
int StringLength = test.Trim().Length > 5 ? 5 : test.Trim().Length;
test = test.Substring(0, StringLength);
No comments:
Post a Comment