Tnx提前幫助。我想將我的點文件擴展名從大寫字母轉換爲小寫字母。例如:ABCD.JPG >> ABCD.jpg,xyz.PNG >> xyz.pngAndroid:將.extensions轉換爲下/大寫
if (attachemtnDescription.toString().endsWith(".JPG") || attachemtnDescription.toString().endsWith(".jpg")) {
attachmentPreviewImg.setImageResource(R.drawable.ic_support_attachment_image);
因爲我有很多的附件類型申報的,所以它的忙亂到兩個申報各類附件大寫和小寫,所以我想減少我的代碼。
我有一種方法來轉換上/下轉換,但如何實現相同的 ...請幫助相同。
EditText edit = (EditText)findViewById(R.id.email);
String input;
input = edit.getText().toString();
input = input.toLowerCase(); //converts the string to lowercase
or
input = input.toUpperCase();
這可能會幫助您重命名。 stackoverflow.com/a/2896829/1977021 – invisbo