將陣列轉換成字串

2021-06-12 20:01:27 字數 691 閱讀 1522

toarray(): //

// 摘要:

//     從 system.collections.generic.ienumerable建立乙個陣列。

//// 引數:

//   source:

//     要從其建立陣列的 system.collections.generic.ienumerable。

//// 型別引數:

//   tsource:

//     source 中的元素的型別。

//// 返回結果:

//     乙個包含輸入序列中的元素的陣列。

//// 異常:

//   system.argumentnullexception:

//     source 為 null。

public static tsource toarray(this ienumerablesource);

例:將陣列轉換成字串

string str = "abcde";

char strs = str.toarray();

foreach (char item in strs)

//模範toarray()的實現

char  strs=new char[str.length];

for (int i = 0; i < str.length; i++)

將資料型別轉換成字串,將字串轉換成資料型別

方法1 採用靜態方法 int a 123456789 string str string.valueof a 方法2 用包裝類轉換 float a 2.33f string str float.tostring a double a 2.33d string str double.tostring ...

講陣列轉換成字串

把陣列轉換為字串 解決辦法 使用join 方法 討論 actionscript 提供內建的方法join 可以快速把陣列轉換為字串 陣列中的元素不管什麼型別都將轉換為字串 該方法接受個引數作為分隔符 var letters array a b c trace letters.join 顯示 a b c...

陣列字串轉換成JSONArray

private object steps list flows service.findallflow page offset,offset 宣告乙個jsonarray 用於轉成json陣列物件 jsonarray jsonarray jsonarray.parsearray flows.get 6...