I guess my previous email should have said what I'm trying to do. I'm searching through an LC script to find all occurrences of a string and then replacing it with another string. The quote thing causes a problem with expressions such as
if "xyz" is among the lines of the customkeys of .... I can't replace the quotes around xyz because that changes the whole meaning of the if statement and makes xyz look like a variable. Any suggestions on how to do this? Maybe put quote & "xyz" & quote into a variable and search for it? Pete Haworth On Jan 9, 2011, at 3:14 PM, J. Landman Gay wrote: > On 1/9/11 4:48 PM, Peter Haworth wrote: >> Got weird things going on with the wordoffset function. The code >> is: >> >> put wordoffset(field "Selection",myLine) into mywordoffset >> >> if field Selection contains xyz and myline contains abc def xyz, then >> wordoffset returns 3. >> >> if field Selection contains xyz and myline contains abc def "xyz" >> (xyz in double quotes this time), wordoffset returns zero. >> >> I've tried this with all combinations of casesensitive and >> wholematches true and false. >> >> According to the dictionary, "A word is delimited by one or more >> spaces, tabs, or returns, or enclosed by double quotes" so why isn;t >> "xyz" recognised as a word? > > Well, wordoffset looks at the beginnings of words, and the first character in > your second example is a quotation mark. So xyz isn't at the start of a word > in the second example, but quote+xyz is. > > You can replace quotes with empty before getting the offset and then you'll > get what you expect. > > -- > Jacqueline Landman Gay | jac...@hyperactivesw.com > HyperActive Software | http://www.hyperactivesw.com > > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your subscription > preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode