Problem with the certification exam (UIARD)

I just took my UIARD certification exam and the following concern arose:

a question said.

A developer wants to determine if two strings are the same (str1) and (str2) which expression allows a case-sensitive comparison?

The available answers were

str1.contains(str2)
str1.toUpper.equasl(str2.toUpper)
srt1.equals(str2)
str1<>str2

I took the test in studio and this question has 2 correct answers.
str1.contains(str2)
srt1.equals(str2)
In both expressions you can identify uppercase from lowercase

The issue is that in the exam you can only choose one answer, how do I know which one is correct? or how do they take the correct answer?

Hi,

We cannot evaluate equivalence of both variables by this expression. For example, in case of str1=“AA” and str2=“A”, it returns true but not equal.

Regards,

Hi @alexis.mendoza
In UiPath, to determine if two strings are the same in a case-sensitive manner, you can use the following expression:

str1.Equals(str2)

This expression checks if the two strings str1 and str2 are identical while considering their case sensitivity.

Explanation of other options:

  1. str1.contains(str2): This expression checks if str1 contains the substring str2. It does not perform a direct comparison to see if the entire strings are the same or not. It’s more about checking if one string is a part of another.

  2. str1.toUpper.Equals(str2.toUpper): This expression converts both str1 and str2 to uppercase using the toUpper method and then checks if the resulting uppercase strings are equal. This would perform a case-insensitive comparison, meaning it would consider “abc” and “ABC” as the same.

  3. str1<>str2: This is not a valid expression in UiPath or most programming languages for comparing strings. It doesn’t represent a valid comparison operation. You typically use operators like .Equals or .CompareTo for string comparisons in UiPath.

  4. str1.Equals(str2): The expression str1.Equals(str2) is used for string comparison in UiPath.

  • str1 and str2 are the two string variables you want to compare.
  • .Equals() is a method used to compare two strings.
  • This comparison is case-sensitive, which means it will consider differences in uppercase and lowercase characters. For example, “Hello” and “hello” would be considered different strings.
  • If str1 and str2 are identical (have the same characters in the same case), the expression will return True, indicating that the two strings are the same.
  • If there is any difference between the strings, it will return False.

So, using str1.Equals(str2) is the appropriate way to determine if two strings are the same in a case-sensitive manner in UiPath.

Hope it helps!!

1 Like

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