how to comparison sting

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vivid


is there a function to compare 2 string ?
I’m from ‘C’ and I’m lost

Thank you.

if test[1] in “moi” :


vivid | 2019-09-03 16:57

:bust_in_silhouette: Reply From: Zylann

If by “compare” you mean check equality, you can just do string1 == string2 which gives you true if the strings are equal.

If you need a comparison usable for alphabetic sorting, you can also do string1 < string2, which returns true if string1 comes before string2.