How can I determine if a String is non-null and not only whitespace in Groovy? November 12, 2022 by Tarik Another option is if (myString?.trim()) { ... } (using Groovy Truth for Strings)