How to detect if a text starts with an another text?

Hello, coding guys,

as you saw in the title of this first post, I would like to detect if a text, like “hello world” contains "hello " ( the space is not a mistake ) , like, a function, or something, I don’t know… I just literally heard “thunkable” for the first time.

Hey @nurkapps :wave:

Welcome to the community and Thunkable! What kind of app are you looking to build?

A combo you may find useful looks like:

See it in action here and read more about text blocks here!

Happy thunking!

It seems like it doesn’t if a text starts with an another text, not contains.

EDIT: Oh, you can’t just put “https://” or “http://” or “puck:” in the middle of an URL like: scratch.mit.https://edu, that would be… A nonsense.

1 Like

Sorry! I misunderstood.

check this out.

The idea here is we check
if extracted text = text to find
set label text = ‘found’
else
set label text = ‘not found’

the special sauce here is the extracted text to compare. I extract, from the start, an equivalent number of characters from the main text as the number of characters in the text to find. I use the length of string block to find that length. I compare that substring or extracted text against the term to find and if they are equal, 1 set of logic occurs else, another set of logic occurs.

Read more about text blocks here !

Happy thunking!

I think this script is the solution: