package com.sinosoft.am.systemFile.service; public class Test{ public static void main(String[] args) { String a="E:\\消息发送\\原型\\toSendMsg.html"; int g=a.lastIndexOf("\\"); String b=a.substring(g); String c=a.substring(0, g); System.out.println("路径为==="+c); System.out.println("文件为==="+b); // System.out.println("路径为==="+c); System.out.println(a.length()); } }