TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: csgoh on June 17, 2010, 02:57:38 AM
-
I am having problem with the function wcmatch.
For eg I have a string "123-567" how to use wcmatch to test for the "-" character.
-
_$ (setq str "1234-5678")
"1234-5678"
_$ (WCMATCH str "*-*")
T
_$ (VL-STRING-SEARCH "-" str)
4
_$ (VL-STRING-SEARCH "a" str)
nil
-
As posted by kpblc, you could use:
(wcmatch <string> "*-*")
If you know there are definitely going to be three numbers each side, you could also use:
(wcmatch <string> "###-###")
-
Lee,
Command: (setq str1 "1234-5678")
"1234-5678"
Command: (wcmatch str1 "[0-9]*-[0-9]*")
T
Command: (setq str2 "a14-5678")
"a14-5678"
Command: (wcmatch str2 "[0-9]*-[0-9]*")
nil
Command: (setq str3 "1-2")
"1-2"
Command: (wcmatch str3 "[0-9]*-[0-9]*")
T
-
Thanks Joe, I need to brush up on my Wildcard Strings...
-
More info here
http://www.theswamp.org/index.php?topic=28210.0
http://www.theswamp.org/index.php?topic=5004.msg60485#msg60485
http://www.theswamp.org/index.php?topic=28210.msg337978#msg337978
http://www.theswamp.org/index.php?topic=28210.msg337979#msg337979
http://www.theswamp.org/index.php?topic=27733.msg333229#msg333229
-
thanks, guys
-
Thanks Alan, those are great 8-)