How can i check if there is only the "-" character in a cell in an excel

Hi all. I’m new to UiPath and I need your help. Thank you in advance!

How can i check if there is only the “-” character in a cell in an excel. I want to use as a condition in an if activity

More precisely, if the cell contains only the “-” character is true, otherwise if the cell contains other characters besides the “-” character it is false

Hi Silviu Albisoru,

You can use Read Range Activity to read excel.
For each row activity for row iteration
then you can apply If Activity
you can give condition,
CurrentRow(0).ToString.Contains(“-”)
where 0 is Column Index , it depends on you from which column you want to iterate 0,1,2,3…

Thanks,
Rounak

Thanks a lot for the answer! That’s what I did, as you say. But, in the if activity, in Then it tells me that it is true if the cell contains only the “-” character and if besides this character there are other characters.

Example result:

“-” = true
“string-string” = true

The result must be:

“-” = true
“string-string” = false

Hey!

Could you please show us input snap so that will get to know!

Contains: This will check the character or word from the entire text, If found this will give you the True Else False.

Example:

Input_Text: I am robot - From Forum

Input_Text.Contains("-")

Then-> True
Else-> False

Conclusion: The condition is true because the text which we’re searching is found in the input text

Equals: This will Checks the condition that the words must match with the entire text

Example:

Input_Text: I am robot - From Forum

Input_Text.Equals("-")

Then-> False
Else-> True

Conclusion: The condition is False because the text which we’re searching is Not found in the input text

Regards,
NaNi

The conditions must be as follows:

“-”=true
“Error-1”=false
“Error2”=false

Hey!

In this case we can use Equal instead of contains

Use If Condition like this:

CurrentRow(3).ToString.trim.Equals("-")

In then part Do your next steps
In else part it executes the Other than “-”

Regards,
NaNi

Thank you very much for your help! I wasn’t careful, it went with Input_Text.Equals (“-”)

1 Like

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