devitg Posted March 24, 2022 Posted March 24, 2022 (edited) Hi I have this two possible string (setq note "gt8" ) or (setq note "ht125,jk34,xx25") My question how to get if the string note hold a , or not as by it (wcmatch "ht125,jk34,xx25" "*,*" ) ; return T (wcmatch "gt8" "*,*" ) ; it also return T Both return T , I need (wcmatch "gt8" pattern ) ; return NIL My question how to state the pattern Edited March 24, 2022 by devitg need to change Quote
exceed Posted March 25, 2022 Posted March 25, 2022 (edited) (wcmatch "ht125,jk34,xx25" "*`,*") T (wcmatch "ht125" "*`,*") nil http://docs.autodesk.com/ACD/2011/ENU/filesALR/WS1a9193826455f5ff1a32d8d10ebc6b7ccc-6754.htm have to add ` in front of character which has some function. this is backquote ` (leftside of 1) = grave key, not quote ' (rightside of L in keyboard) because wcmatch can have multiple pattern like this. (wcmatch "Name" "???,~*m*,N*") in this case , means "OR" or can use ascii code of ` = (chr 96) (wcmatch "ht125,dsdf,sdf" (strcat "*" (chr 96) ",*")) T (wcmatch "ht125dsdfsdf" (strcat "*" (chr 96) ",*")) nil Edited March 25, 2022 by exceed 3 Quote
mhupp Posted March 25, 2022 Posted March 25, 2022 You could also use lists. list also have a added benefit of easier data manipulation. (setq note (list "ht125" "jk34" "xx25")) ("ht125" "jk34" "xx25") (member "gt8" note) nil (member "jk34" note) ("jk34" "xx25") 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.