Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: vonsmith on November 12, 2003, 05:53:41 pm
-
I'm trying to figure out the syntax of the HalBrain.SearchPattern(...) function.
This works:
Dim Phrase
Phrase = HalBrain.SearchPattern(UserSentence, "* DEFINITION OF *", 2)
This doesn't:
Dim TextString, Phrase
TextString = """* DEFINITION OF *"""
Phrase = HalBrain.SearchPattern(UserSentence, TextString, 2)
Am I doing something wrong or doesn't the HalBrain.SearchPattern(...) function accept variables for the string argument?
Robert Medeksza, Don, onthecuttingedge2005, anyone? Help please.
Thanks,
= vonsmith =
-
Hello,
I haven't had a chance to experiment with the searchpattern function, but I don't understand what you're doing with the second example (the one that you say doesn't work). Why do you have three sets of double quotation marks?
I am probably failing to see something obvious. Could you possibly annotate each line of code, stating your intent for each line?
Sincerely,
Don
-
Don,
As I understand it you have to use double quotes to quote a quotation mark.
If you do it this way...
text = ""word""
GetResponse = text --> doesn't print "word" and you will get an error.
Instead...
text = """word"""
GetResponse = text --> does print "word"
What I'm trying to do is to have HalBrain.SearchPattern(...) work with a string variable and not just a string. This way many various search patterns can be passed to the search function without having a instance of HalBrain.SearchPattern(...) on every line. If I wanted to search 50 patterns it would take 50 lines to do it. If I select string variables from an array of 50 string variables I can just use a For,Next loop and one instance of the HalBrain.SearchPattern(...) function.
Example:
Dim PatternArray
'Initialize array.
PatternArray = Array("""* DEFINITION OF *""","""* WHAT'S ""","""* HOW """)
For I = 0 to 2
TextString = HalBrain.SearchPattern(UserSentence, PatternArray, 1)
Next
Thanks for the input. I guess I should ask Robert M. if he would publish some info on the various Hal functions.
= vonsmith =