通过与扩展进行比较来测试模式是否是.jpg或.xml

编程入门 行业动态 更新时间:2024-10-24 20:11:22
本文介绍了通过与扩展进行比较来测试模式是否是.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

本文发布于:2023-10-23 14:05:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521044.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模式   测试   xml   jpg

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!