# How to know if the string, Amy is less than the string Astor

**URL:** <https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107>\
**Category:** Robot Framework\
**Created:** [16 December 2020 18:21 UTC](https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107 "2020-12-16T18:21:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeleBack](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@TeleBack](https://forum.robotframework.org/u/TeleBack)\
**Post date:** [16 December 2020 18:21 UTC](https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107/1 "2020-12-16T18:21:30Z")

</div>

I have been searching to no avail I hope someone can help me.

Is there a way know if one string is less than another? In other words, if the name Amy should come before Astor, I would like to receive a result/status of True.

Thank you!

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [16 December 2020 19:04 UTC](https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107/2 "2020-12-16T19:04:25Z")

</div>

In Python you can just compare strings with the `>` or the `<` operator.

Same in Robot.

The python expression `"Amy" < "Astor"` evaluates to True.

Now the question is, where you want to use it in Robot Framework.

With a `Run Keyword If` ? Or with a python inline evaluation?

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [16 December 2020 19:07 UTC](https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107/3 "2020-12-16T19:07:49Z")

</div>

```python
***Test Cases***
Test
    ${str1}= Set Variable Amy
    ${str2}= Set Variable Astor
    Run Keyword If $str1 < $str2 Log To Console ${str1} comes before ${str2}

```

---

<div class="post-metadata">

**Author:** ![TeleBack](https://avatars.discourse-cdn.com/v4/letter/t/c0e974/32.png) [@TeleBack](https://forum.robotframework.org/u/TeleBack)\
**Post date:** [16 December 2020 19:31 UTC](https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107/4 "2020-12-16T19:31:32Z")

</div>

Thank you René, I leaned something new today!!

That helped me a lot. I was using two spaces before and after the \< symbol.

Merry Christmas to you (and everyone)!

---

<div class="post-metadata">

**Author:** ![René](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/ren%C3%A9/32/7_2.png) [@René](https://forum.robotframework.org/u/Ren%C3%A9)\
**Post date:** [16 December 2020 22:25 UTC](https://forum.robotframework.org/t/how-to-know-if-the-string-amy-is-less-than-the-string-astor/1107/5 "2020-12-16T22:25:15Z")

</div>

Merry Christmas! 🎄🎁
