Write code to remove File Name Suffix from path string
//package com.book2s; public class Main { public static void main(String[] argv) { String srcName = "book2s.com"; System.out.println(removeFileNameSuffix(srcName)); }// w w w .j a va2 s . co m public static String removeFileNameSuffix(String srcName) { int dotIndex = srcName.lastIndexOf("."); if (dotIndex == -1) return srcName; else return srcName.substring(0, dotIndex); } }