38-文件后缀名
2015-11-13 10:35
381 查看
<pre name="code" class="java">//获取文件名,不带后缀
var file_name=file_path.replace(/(.*\/)*([^.]+).*/ig,"$2");
//获取文件后缀 1.var FileExt=file_path.replace(/.+\./,"");
2.var fileExtension = file_path.substring(file_path.lastIndexOf('.') + 1);
//截取文件后缀 var reg = /\.\w+$/; var file_name = file_path.replace(reg,'');
<div> var postfix=file.substr(file.lastIndexOf(".")+1,file.length); </div>
java
public class StringDemo {
public static void main(String[] args) {
String str = "www.yiibai.com";
System.out.println(str);
// the end string to be checked
String endstr1 = ".com";
String endstr2 = ".org";
// checks that string str ends with given substring
boolean retval1 = str.endsWith(endstr1);
boolean retval2 = str.endsWith(endstr2);
// prints true if the string ends with given substring
System.out.println("ends with " + endstr1 + " ? " + retval1);
System.out.println("ends with " + endstr2 + " ? " + retval2);
}
}
相关文章推荐
- 内嵌支持宽高激活因子、清除浮动常用方法
- Go语言反射规则 - The Laws of Reflection
- EXVIM使用笔记
- diff命令生成补丁
- MapReduce计数器计数
- framebuffer小程序显示3个矩形 测试
- Linux下实现磁盘配额的两种方法
- Android基础入门教程——10.9 WallpaperManager(壁纸管理器)
- Canvas画简易的Calendar控件
- 64位linux centos 安装android问题及解决方案
- 一些题目iOS
- nodejs微信开发--网页获取用户授权信息
- 根据IE和FF加载不同css样式文件
- ToolBar的使用
- 开博首记
- Genymotion模拟器的常见问题集合
- Hbase 建表操作实例源码
- 断言(C++大师Andrei Alexandrescu的文章)[卸载microsoft visual c++ debug library]
- word 嵌入式图片不能显示,只显示一行。
- arcengine属性查询 一些记录