Hello everyone,
I am getting this error suddenly from yesterday onwards.
Error : If: startIndex cannot be larger than length of string. (Parameter ‘startIndex’)
How can I resolve this? before resolving I want to know why this error arrived? what’s the reason ?
Screenshot :
Hi @prabin_chand1
Looks like you are trying to perform a substring larger than lenght of your string, please check your value and count the characters there
Regards
Anil_G
(Anil Gorthi)
March 25, 2023, 4:15am
3
@prabin_chand1
Are you using any list or anything in the condition or using substring?
It says the start indexyou provided is more than the total values present or the length of the string
Cheers
Yoichi
(Yoichi)
March 25, 2023, 6:09am
4
HI,
Can you try the following condition?
CardNumber.StartsWith("405019") AndAlso CardNumber.Length>=6 AndAlso not CardNumber.Substring(6).Contains("0000")
Regards,
1 Like
What’s the difference between And & AndAlso.?
Yoichi
(Yoichi)
March 25, 2023, 8:03am
6
Hi,
Andalso is short-circuiting operator. if the first condition is False, the following condition won’t be evaluated. (And operator always evaluates both conditions. It might be caused exception)
Please see the following document in details.
Regards,
1 Like
system
(system)
Closed
March 28, 2023, 8:04am
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.