Index and length must refer to a location within the string with a Parameter name length

I have a .Substring(0,15) but when I have a string of “Asdfg” that’s less than 15 an error of length must refer to a location within the string appears, is there a way to have the length max 15 but can take any length up to 15?

Hi @duaine.b ,

Could you check with the below expression :

if(strVar.Length>=15,strVar.Substring(0,15),strVar)

Just use the Left method

Left(“My String”,15)

…won’t give an error.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.