How would you match a single string in all args of a text label?

Hey Developers,
So basically I’m trying to check all args of a text label to see if a specific string is found.
This is what I have so far;

local BADGES_TEXT = string.lower(TARGET_CHARACTER.Head.Rank2.PlayerBadges.Text)
	if BADGES_TEXT:sub(4, 5) == "💝" then
		--// code here

But this obviously wouldn’t work if the :gift_heart: is between lets say 3,4, or 6,7. So how could I check all args to see if the :gift_heart: exists? I don’t want to see if the text label has only the heart, the text label will also have other emojis. So how do I filter through all those emojis to see if the emoji is there?

Use string.find or string.match

if BADGES_TEXT:find("💝") then
1 Like

Use string.find(string.pattern) to locate the emoji.

1 Like

You can use :find, if you care about where it is. And you wouldn’t need to check up to
a specific endpoint

local text = string.lower(TARGET_CHARACTER.Head.Rank2.PlayerBadges.Text)

local i, j = text:find("💝")

if i and j then
    -- found something
1 Like

This worked the best for me. Thanks!