# Check isGreater and IsEqual and isLesser from in a string

Hey everyone, I am getting a text from Get Text activity and it is basically a string. It could be like 8-9, 2-7, or any n-n range and <, > signs with n as well for example <10, >10. I have to check that if the Duration of residence (n) is <10 then I should return true else return false.

Similarly, I am getting another string, if it contains age between 60-64 or >65 then I have to return true else false.

I am attaching the screenshot of my problem for more clarity.

Maybe you would just need to check if the string contains `<10` ?

``````yourExtractedText.Contains("<10")
``````

Similarly, for this case :

``````yourOtherExtractText.Contains("60-64") orElse yourOtherExtractText.Contains(">65")
``````
2 Likes

what if my string contains Duration of residence 5? Which means it is less then 10. Similarly if age is 72 it is greater than 65. In both cases strings are not containing <10 and >65 but are still true.

To check if the Duration of residence (n) is less than 10 or not, you can use the following steps:

1. Use the Matches activity to extract the numerical value from the string using a regular expression. For example, for the string â€śDuration of residence <10â€ť, you can use the regular expression â€ś\d+â€ť to extract the number 10.
2. Convert the extracted numerical value to an integer using the CInt function.
3. Check if the integer is less than 10 using a simple If condition. If it is less than 10, return true, else return false.

Similarly, to check if the age is between 60-64 or greater than 65, you can use the following steps:

1. Use the Matches activity to extract the numerical value from the string using a regular expression. For example, for the string â€śAge >65â€ť, you can use the regular expression â€ś\d+â€ť to extract the number 65.
2. Convert the extracted numerical value to an integer using the CInt function.
3. Check if the integer is between 60-64 or greater than 65 using a simple If condition. If it is, return true, else return false.
1 Like

@Nitya1 what it will return in this case? I think it will return 68 which is wrong isnâ€™t it?

It will return true in this case as its less than 10.

1 Like

A bit of a confusion.

Do you want to validate if your number `n` is greater `10` ? since the image is also showing up as `>10` ? Or is the `>10` Check a constant check ?

Also for the other case, the age number letâ€™s say `ageVar`, do you want to check if this number is according to the criteria in the image i.e `50-54` ? Or is it again a constant check as mentioned `60-64` or `>65` ?

1 Like

Yes I want to validate that it is greater than 10.

The second check is constant like if the ageVar get the string 50-54 we must have a mechanism by which we can check that ageVar is either between 60-64 or greater than 65.

@Nitya1 Thank you so much it worked for me.

1 Like

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