0

Does the index start at 0 or at 1 for AMPscript?

Substring(@str, 0, 1) and Substring(@str, 1, 1) have the same result.

E.g. If @str = "male". The result in both cases is m.

1 Answer 1

0

Review the help doc for the function : Substring

and reviewing the example and considering your test, it appears to start at 1

%%=Substring('abcdef',2,2)=%% returns bc

1
  • 1
    To add on to this instead of dilute with multiple answers - not exactly comprehensive or definitive, but it is explicitly stated in the IndexOf function that the index starts at 1 (developer.salesforce.com/docs/…) Apr 20, 2021 at 18:33

You must log in to answer this question.