G5 : StrFind & StrRFind functions not available ?

Hello,

Previously in GD4, we had these function available to manipulate text objet :
Text.String()
NewLine()
SubStr(“text”,charPos,length)
StrAt(“text”,charPos)
Text.Angle()
Text.Opacity()
StrFind(“text”,“whatToSearch”)
StrFindFrom(“text”,“whatToSearch”,posNum)
StrLength(“text”)
StrRFind(“text”,“toSearchFromEnd”)
StrRFindFrom(“text”,“toSearchFromEnd”,lastPosNum)

In GD5, the expression editor doesn’t accept functions like StrFind() or StrRFind() ???

How can i easily test if a string exist in another string, and returning a value to test if it’s true or false ?

Thanks

The functions exist, note that StrFind() and StrRFind() returns a number (the matching position) so you can use it for numeric expressions only or converting it to string (ToString()) to use it on string expressions :slight_smile:

The StrFind(“source_string”, “string_to_search”) returns the matching position (starting from 0) or -1 if the string is not found, so this condition:
StringExist.png
will be true if the “StringToSearch” is found in “MySourceString”, instead “> -1” you can use “>= 0” or “!= -1” (maybe the last one is more appropiate) :wink:

ha… My fault, i was using it in “Modify the text of a text object” without converting it into a string…

Thanks dude :slight_smile: