Iterating with foreach on Text variables

Important

This content is archived and is not being updated. For the latest documentation, go to What's new and planned for Dynamics 365 Business Central. For the latest release plans, go to Dynamics 365, Power Platform, and Cloud for Industry release plans.

Enabled for Public preview General availability
Admins, makers, marketers, or analysts, automatically Mar 1, 2023 Apr 1, 2023

Business value

Sometimes you need to loop through text strings—for example, to identify characters, remove, or replace them. With this release we are adding support for using the foreach operation on Text variables, making it easier to perform this iteration.

Feature details

You can now use the existing foreach loop operation on Text variables, allowing you to detect as well as remove or replace individual characters in strings.

Use the foreach keyword to iterate over Text variable characters

Tell us what you think

Help us improve Dynamics 365 Business Central by discussing ideas, providing suggestions, and giving feedback. Use the forum at https://aka.ms/bcideas.

See also

Foreach control structure (docs)