How do I remove extra spaces from a choice list field using Groovy?

This topic covers how you can use Groovy to trim white spaces in a choice list field.

You can use the trim() method to remove leading or trailing spaces when iterating the list. For example,
// trim email to remove any possible white space
for (email in recipientList) {
  def trimmedEmail = email.trim()
  // Do something here with the trimmed email
}