Friday, May 26, 2017

#1 2005-10-13 04:13:46 pm

julifos
Administrator
From: MalasaƱa, Madrid
Registered: 2002-11-20
Posts: 2014

How can I know if a specified string is contained in a text?

You can use several expressions:

Applescript:

set theText to "this is a sample"
set lookingFor to "sample"

offset of lookingFor in theText --> if result is not "0", then it is contained
theText contains lookingFor --> true or false, by default ignores case
lookingFor is in contents of theText --> the same

If you are looking for more options and power, take a look to the find text command of the Satimage osax, or use any command-line tool, such as grep.

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.029 seconds, 8 queries executed ]

RSS (new topics) RSS (active topics)