ID:259466
 
What is wrong with this?

mob/verb
say(T as text)
if("Test" in T)
usr << "Test worked"
This should be in Newbie Central, look up findtext().
Da_Rushyo wrote:
What is wrong with this?

mob/verb
say(T as text)
if("Test" in T)
usr << "Test worked"

Two problems:

  • The post belongs in Code Problems or Newbie Central.
  • if("Test" in T) is invalid because the in operator works on a list, not text. What you want is findtext(T,"Test") or findText("T","Test") (the latter is case-sensitive), which will return 0 if "Test" is not found or its index in the string (starting from 1) if it is.

    Lummox JR