I have a string containing a@gmail;b@gmail.com;…xxx@gmail.com. I want to check if there is any part of the string that does not have the extension @gmail.com it will end the program. Do you have any ideas?
Use String function Split and then check if it’s ending with @gmail.com or not.
Try it like this:
Sample code:
Split Function.xaml (8.1 KB)
Edit1: Added sample code.
Thanks,
Ashok ![]()

emailArray = emailString.Split(";"c)
Not email.EndsWith("@gmail.com")
Use Assign activity and store different types
emailString = “a@gmail;b@gmail.com;…xxx@gmail.com”
Assign
emailArray = emailString.Split(“;“c)
Iterate through the emailArray
For Each email In emailArray
Use If condition Not email.EndsWith (”@gmail.com”)
Then Throw New Exception(“Invalid email address found”)
Looks like your processing has a problem. It returns the same result whether the Input is correct or not
It returns the same result whether the Input is correct or not
Use immediate panel and prototype your strings
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
maybe you can share with us, which string was used when testing it
Try this:
Assign -> emailString = "a@gmail;b@gmail.com;xxx@gmail.com"
Assign -> invalidEmailExists = emailString.Split(";"c).Any(Function(email) Not email.Trim().EndsWith("@gmail.com"))
If
invalidEmailExists
Then
Writeline -> "Invalid email found. Ending the program."
\\ Process to end the flow
Else
\\ Process to continue the flow
End If
invalidEmailExists is of DataType System.Boolean
Hope it helps!!
Ohh ok. I think we are interpreting the problem statement incorrectly.
Share something you tried and input and expected output.
Thanks,
Ashok ![]()
I tried again and it worked.Thank you
1 good idea. Thank You
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

