去掉音频的后缀
private static final String[] AUDIO_SUFFIX = {".mp3",".ogg",".wma",".amr"};
private String removeSuffix(String audioName) {
Log.d("eric", "audioName : " + audioName);
StringBuilder name = new StringBuilder(audioName.toLowerCase());
Log.d("eric", "name : " + name);
for (String suffix : AUDIO_SUFFIX) {
if (name.toString().endsWith(suffix)) {
Log.d("eric", "audioName old : " + name);
int start = name.indexOf(suffix);
int end = start + suffix.length();
name = name.replace(start, end, "");
Log.d("eric", "audioName new : " + name);
break;
}
}
return name.toString();
}