Wed, March 8, 2006
拡張子を置き換えたい(javaの場合)
foo.txt から foo.html という文字列をつくる方法
StringクラスのreplaceAll()を使用
java.lang.String#replaceAll() メソッドを使って置き換える。
String txtfile="foo.txt";
String htmlfile=txtfile.replaceAll(".txt$",".html");
System.out.println(htmlfile);