wcmatch(按文件扩展名)
大家好,我试图创建一个变量时,现有的变量有一个特定的文件扩展名与之相关。
这是代码
(if (wcmatch (strcase plotstyle) "*.stb")
(setq stbctb "White_200")
)
我已经成功地使用了以下代码,但最终我需要上面的工作。
(if (wcmatch (strcase plotstyle) "MR*")
(setq stbctb "White_200")
)
提前感谢 如果您对plotstyle进行小写,它将不会返回STB,因此请尝试*。机顶盒为我工作。 如果我使用mr*stbctb=White_200…则使用扩展时,它似乎会加载,但stbctb=nil。。。。
与“plotstyle”关联的文件是“MR_filename.stb”。MR是常见的,但如果用户创建另一个以MR为前缀的plotstyle,则它将失败。 BIGAL指出,您应该注意STRCASE函数的行为;在不将第二个参数设置为T的情况下使用它,它将以大写形式返回字符串,而不是按比较预期的小写形式。
(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 当然,对不起。。。。。谢谢你们的回复,伙计们!!
页:
[1]