通过与扩展进行比较来测试模式是否是.jpg或.xml [英] To test the pattern whether it is.jpg or .xml by comparing with the extension

查看:100
本文介绍了通过与扩展进行比较来测试模式是否是.jpg或.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将图像文件写入一个文件,将(xml和html)写入另一个文件中的公共文件中。我试图比较扩展,如果它是.jpg或.bmp它将写入图像文件,如果它是.html或.xml它将被写入应用程序文件。但我无法做到所以我的代码如下:

展开 | 选择 | Wrap | 行号

解决方案

展开 | 选择 | Wrap | 行号


您可以将搜索脚本简化为此:

展开 | 选择 | Wrap | 行号


嗯...... Rajiv发布的内容更加清晰,并且做得非常好。

I need to write the image files in one file and (the xml and html) in another file from a common file. I am trying to compare the extensions,like if it is .jpg or .bmp it will be written to the image file and if it is .html or .xml it will be written to the app file.But I am not able to do so.My code is given below

Expand|Select|Wrap|Line Numbers

解决方案

Expand|Select|Wrap|Line Numbers


You can simplify your search script to this:

Expand|Select|Wrap|Line Numbers


Well...what Rajiv has posted is even more crisp and very well do the job.


这篇关于通过与扩展进行比较来测试模式是否是.jpg或.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆