Check if string only contains grades like A,A+,B,B+

Hi , i want to check under if condition if my string contains only grades such as A or A+ or B or B+ and nothing else inside it how to check that inside if condition

Hi @ashish_negi

Strict matching place would need Equals as comparison and not contains.
lets say if these grades are stored in a datatable
You put a loop for each row
put an if condition
currentRow(“Grades”).toString.Equals(“A”) or currentRow(“Grades”).toString.Equals(“A+”) or currentRow(“Grades”).toString.Equals(“B”) or currentRow(“Grades”).toString.Equals(“B+”)
In the then section perform your logics.

Happy Automation! :smiley:

we can use Regex isMatch method or isMatch Activity

grafik

1 Like

Hi,

Can you try as the following?

arrKeyword ={"A","A+","B","B+"}

Then

arrKeyword.Contains(yourString)

image

Regards,

1 Like

This worked

Thanks for replying this also helped

Hi yoichi, thanks for replying

1 Like

What does it means here $ |\z
$ as i know it’s use for end of the string others ?

grafik
taken from regex101.com

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.