Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find Specific word in string ?
#1
Hi !

I'm kind of stuck, could you help me ? :-)

I want to do some specific actions if a string contains a specific word

for example :

Macro test
Code:
Copy      Help
str text="Hi ! My name's John, I live in Kentucky !"

if text CONTAIN "Kentucky"
,out "Hurray!"


Since now, i'm doing this :
Macro test 6
Code:
Copy      Help
str text="Hi ! My name's John, I live in Kentucky !"

rep 500
,text.replacerx(".Kentucky" "Kentucky" 8)
,text.replacerx("Kentucky." "Kentucky" 8)

if text="Kentucky"
,out "Hurray !"

But i'm sure there's a way to do it properly ( By my way, the execution time is really slowed down with "heavier" strings )

Thanks in advance Smile
#2
Nevermind, i just found out how to do it Smile

Here is my solution :

Macro test 6
Code:
Copy      Help
str text="Hi ! My name's John, I live in Kentucky !"

int i=findc(text "Kentucky")
if i>0
,out "Hurray !"


Forum Jump:


Users browsing this thread: 1 Guest(s)