android轉換string
① android開發中如何講一個list數組轉換成String字元串的形式
public class SplitTest {
public static void main(String args[]) {
String str = "a1.png,a2.png,a3.png";// 原始字元串
String[] arrayStr = new String[] {};// 字元數組
List<String> list = new ArrayList<String>();// list
arrayStr = str.split(",");// 字元串轉字元數組
list = java.util.Arrays.asList(arrayStr);// 字元數組轉list
String[] storeStr = list.toArray(new String[list.size()]);// list轉成字元數組
/* 輸出字元數組的值 */
for (String s : arrayStr) {
System.out.println(s);
}
System.out.println("-------------");
/* 輸出list值 */
for (String s : list) {
System.out.println(s);
}
System.out.println("-------------");
for (String s : storeStr) {
System.out.println(s);
}
System.out.println("-------------");
}
}
② android字元串轉換成16進制怎麼轉
android字元串轉換成16進制,參考如下內容:
/**
* 字元串轉換成十六進制字元串
* @param String str 待轉換的ASCII字元串
* @return String 每個Byte之間空格分隔,如: [61 6C 6B]
*/
public static String str2HexStr(String str)
{
char[] chars = "0123456789ABCDEF".toCharArray();
StringBuilder sb = new StringBuilder("");
byte[] bs = str.getBytes();
int bit;
for (int i = 0; i < bs.length; i++)
{
bit = (bs[i] & 0x0f0) >> 4;
sb.append(chars[bit]);
bit = bs[i] & 0x0f;
sb.append(chars[bit]);
sb.append(' ');
}
return sb.toString().trim();
}
③ Android 怎樣將amr音頻文件轉換成String
下載一個 格式工廠
這個事網站:https://www..com/index.php?tn=56060048_4_pg&ch=12#wd=%E6%A0%BC%E5%BC%8F%E5%B7%A5%E5%8E%82&rsv_spt=1&rsv_iqid=0x9ffe789500019b61&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=56060048_4_pg&rsv_enter=0&rsv_sug3=2&rsv_sug1=1&inputT=5674&rsv_sug4=7147