String中的lastIndexOf(String)
来源:互联网 发布:排版相册套版软件 编辑:程序博客网 时间:2024/06/12 19:38
public class Test1
{
public static void main(String args[])
{
String file="test.txt";
int len=file.lastIndexOf(".");
String filename=file.substring(0, len);
String ext=file.substring(len, file.length());
file=filename+"1"+ext;
System.out.println(len);
System.out.println(filename);
System.out.println(ext);
System.out.println(file);
}
}
//结果:
4
test
.txt
test1.txt
//而这个方法的另外一种重载形式lastIndexOf(String s,int start)则是从start处开始从右向左开始寻找s出现的最右侧的位置
- String中的lastIndexOf(String)
- 关于java.lang.String中的public int lastIndexOf(String,int)
- java String lastIndexOf
- String.LastIndexOf 方法 (Char)
- Java中的String中的substring、indexof()、lastindexof()和split
- String-lastIndexOf()、replace()简单使用
- String方法lastIndexOf、indexOf、split
- String 之 搜索字符 indexOf 和 lastindexOf
- 自己写的j2me 中String 中的replace,spit,lastIndexOf 函数
- string public int LastIndexOf(string value, int startIndex, int count);
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
- linux 之top命令详解
- OBLOG Accesss 转SQL Server 常见问题及解决方法
- 数据访问基础类(基于SQLServer)
- css选择器
- 下雪特效
- String中的lastIndexOf(String)
- portal自动生成
- 测试工具LoadRunner和OpenSTA比较分析
- 邮件头信息
- A tip when running javascript dynamically
- flex DataGrid与Tree 基于xml的绑定
- 在C++中声明全局const的方式
- webform页面间传值的特殊方法
- C# 设置Windows 窗体的屏幕位置,动态创建的Form