Condition builder (if) possible to use “contain” 3 or more times for the same kind of symbol?

Is it a problem to use:

“Titel” Contains “-“
And
“Titel” Contains “-“
And
“Titel” Contains “-“

To check if titel contains 3 times “-“
Or even more?
Is there a better way to do this?
It doesn’t work for all my titels :thinking:

I hope this question is not too stupid :blush:

Hi @Ella

Can u share the sample text which are comapring with condition

@Ella Maybe you can use a regular Expression to get the Count of Hyphen’s in your text. Check the example below :

strText = "Hello-Hi-Bye-See-You-Later"         \\strText is a String
hyphenCount = System.Text.RegularExpressions.Regex.Matches(strText,"-").Count       \\hyphenCount is an Integer

You can then Check if the Count is greater than 2 or more using an If Activity.

if hyphenCount >=2
1 Like

The code doesn’t work, I think I forget somthing … is the code compleet? Because with other regex it worked . I’m working in studio X.

My text is always different but I only need the text when it has a specified number (or minimum number) of symbol - in it. It’s not always in the same position :neutral_face: I’m working in studioX

@Ella…if you could give us one sample and your expected output …we can help you better…

  • I want to check if the text contains 4 times symbol -

m/t/condition builder if possible - to use contain - 3 or more - times - for the same kind of symbol/272899/6…

  • If the text doesn’t contain 4 times symbol - I need to count/search for example 3 times symbol /

mt / condition builder if possible - to use contain 3 or more times - for the same kind of - symbol / 272899 / 6…

@Ella - Please check this out…

Main.xaml (16.6 KB)

If you run the program as is, you will get the output as

image

My input String: symbol / 272899 / 6 / 1978

Write Line --> Count is: 3

Please make pertinent changes to fit for you needs…Hope this helps…

afbeelding

I can not open the project :neutral_face:

@Ella - Save the xaml and open that file from Uipath (open project) …

or Try this building the activities as shown below…

  1. Save for Later --> Saved.Values(Of String)(“StrInput”) = string.Format(“symbol / 272899 / 6 / 1978”)

  2. write Line --> “Count is: " + System.Text.RegularExpressions.Regex.Matches(Saved.Values(Of String)(“StrInput”),”/").Count.ToString

  3. If --> System.Text.RegularExpressions.Regex.Matches(Saved.Values(Of String)(“StrInput”),"/").Count > 3

Then --> MessageBox --> string.Format(“Count is greater than 3”)
Else --> MessageBox --> string.Format(“Count is equal or less than 3”)

1 Like

Thank you so much !

1 Like

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