【 解 説 】
Fileの拡張子抜きの名前を得るには、次のようなメソッドを使用します。
【 例 文 】
1 2 3 4 5 6 7 8 9 |
public String getNameWithoutExtension(File file) { String fileName = file.getName(); int index = fileName.lastIndexOf('.'); if (index != -1) { return fileName.substring(0, index); } return ""; } |
■お薦め参考関連資料
Sun、Sun Microsystems、サンのロゴマーク、Java、Solarisに関連するすべての商標およびロゴマークは、米国 Sun Microsystems, Inc. の米国およびその他の国における商標または登録商標です。