AL icon indicating copy to clipboard operation
AL copied to clipboard

Enforce Substring start index must be more than 1 during compilation

Open tuan-nguyen-fenwick opened this issue 3 years ago • 1 comments

Hi AL Language Development Team,

Could you enforce the start index of Substring(...) to be more than 1 during compilation?

We encountered an issue where users run an action that triggers the following code. image

And they got this error during runtime. image

I think this error can be prevented by enforcing the above rule. Thank you.

Kind regards, Tuan Nguyen

tuan-nguyen-fenwick avatar Oct 06 '22 05:10 tuan-nguyen-fenwick

I guess every String Method that supports a 1-Based StartIndex should lead to compile time errors. e.g. https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/text/text-remove-method

pri-kise avatar Oct 07 '22 06:10 pri-kise

We have internally discussed this issue and have decided not to accept this issue to be fixed at the moment to prioritize other issues. Thank you for raising this concern.

thloke avatar Nov 01 '22 09:11 thloke