jnky Posted August 19, 2014 Posted August 19, 2014 Hi all, Im trying to create a variable when an existing variable has a certain file extension associated with it. This is the code (if (wcmatch (strcase plotstyle) "*.stb") (setq stbctb "White_200") ) I have been successful with the following code but ultimately I need the above to work. (if (wcmatch (strcase plotstyle) "MR*") (setq stbctb "White_200") ) Thanks in advance Quote
BIGAL Posted August 19, 2014 Posted August 19, 2014 If you strcase the plotstyle will it not return STB so try *.STB worked for me. Quote
jnky Posted August 19, 2014 Author Posted August 19, 2014 It seems to load but stbctb = nil when using the extension, If I use mr* stbctb = White_200.... The file associated with 'plotstyle' is "MR_filename.stb" the MR is common but if users create another plotstyle prefixed with MR then it will fail. Quote
MSasu Posted August 19, 2014 Posted August 19, 2014 What BIGAL pointed is that you should pay attention to STRCASE function's behavior; using it without the second argument set to T, it will return the string as uppercase, not lower case as expected by your comparison. (wcmatch (strcase "test.stb") "*.stb") ;nil (wcmatch (strcase "test.stb") "*.STB") ;T (wcmatch (strcase "test.stb" nil) "*.stb") ;nil (wcmatch (strcase "test.stb" nil) "*.STB") ;T (wcmatch (strcase "test.stb" T) "*.stb") ;T (wcmatch (strcase "test.stb" T) "*.STB") ;nil Quote
jnky Posted August 19, 2014 Author Posted August 19, 2014 Of course, sorry.....Thanks a lot for your replies guys!! 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.