|
jed Adept
Joined: 18 Dec 2005 Posts: 246
|
Posted: Sun Dec 24, 2006 3:12 am
Matching a a multi word variable to a multi word list |
I have a variable called newname which may contain a multi word value (i.e. huge bone helmet.txt) and the @directlist value is a string list of multi word values (i.e. huge bastard sword).
Code: |
%ismember(%lower(@newname),@directlist) |
However when I run this bit of code, it appears to match only the first word, so If I run this with huge bone helmet as the value for @newname, but it is not in the @directlist string list, it still returns true... I tried to place quotes around %lower(@newname) but that didnt work... any suggestions on how to match this? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Dec 24, 2006 3:38 am |
Quotes will turn stuff within them into literal strings that don't get parsed at all. If you want the parsing, use curly braces.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
jed Adept
Joined: 18 Dec 2005 Posts: 246
|
Posted: Sun Dec 24, 2006 4:06 am |
{%lower(@newname)} did it... Although I don't understand why... hehe. Thanks!
|
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Dec 24, 2006 6:36 am |
It's because of how CMud parses things by using whitespace as a boundary. Without the {} CMud gets confused and doesn't always count correctly, or figures out what the correct number should be and ignores anything else. The braces tell CMud that the stuff within is considered one entity.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|