Jump to content

Recommended Posts

Posted (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 by devitg
need to change
Posted (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 by exceed
  • Like 3
Posted

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")

 

 

  • Like 2

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...