Manuel_Kunde Posted August 19, 2021 Share Posted August 19, 2021 (edited) Hi, I'm trying to query the variable "Weight" and if it has the content "50" I want to define a new variable: "Stamp" with the content "internal". Is WCMATCH the right command for this? (if (= wcmatch Weight "50") (progn (setq stamp "intern"))) (princ) Edited August 19, 2021 by Manuel_Kunde Quote Link to comment Share on other sites More sharing options...
Steven P Posted August 19, 2021 Share Posted August 19, 2021 Put a * either side of the 50 (for a wildcard search) and take out the = and it should work I think (if (wcmatch Weight "*50*") (progn (setq stamp "intern")) ) Quote Link to comment Share on other sites More sharing options...
Manuel_Kunde Posted August 19, 2021 Author Share Posted August 19, 2021 20 minutes ago, Steven P said: Put a * either side of the 50 (for a wildcard search) and take out the = and it should work I think (if (wcmatch Weight "*50*") (progn (setq stamp "intern")) ) This works, thanks. 1 Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted August 19, 2021 Share Posted August 19, 2021 For an exact match, you can use: (if (= weight "50") (setq stamp "intern")) Note that the progn expression is not required as you are only supplying a single expression as the 'then' argument for the if statement. Quote Link to comment Share on other sites More sharing options...
Grrr Posted August 19, 2021 Share Posted August 19, 2021 Heres another way: (setq stamp (cond ((= Weight "50") "intern"))) Quote Link to comment Share on other sites More sharing options...
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.