Java 字符串 之 字符串查找和截取
http://www.verejava.com/?id=16993032213987 /** 5. 字符串的查找和截取 1. String substring(int beginIndex) 从beginIndex索引开始截取到末尾的字符串 2. int indexOf(char ch) 从头开始查找字符 ch 在字符串中的索引位置, 如果没有查到返回-1 3. int lastIndexOf(char ch) 从末尾开始查找字符ch在字符串中的索引位置, 如果没有返回-1 */ import java.util.Scanner; public class TestString4 { public static void main(String[] args) { //说明: 键盘输入文件地址, 截取文件名称和扩展名 System.out.println("请输入文件的地址..."); Scanner in = new Scanner(System.in); String filePath = in.nextLine(); //去掉前后空格 filePath = filePath.tr...