C怎麼把一堆陣列,轉化為字串,c 中如何將一維陣列轉換為字串

2021-04-29 06:01:54 字數 4364 閱讀 1655

1樓:玩轉資料處理

string filenames = directory.getfiles(strpath);

fileinfo fileinfo;

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

2樓:匿名使用者

string str="";

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

str=str+filename[i];

str=str.replace("d:\\vs2008\\地理bai1\\地理1\\bin\\debug\\","");

定義一個du字串,然後把數

zhi組拼dao

成字串,再替換,內已容測試通過

c#中如何將一維陣列轉換為字串

3樓:匿名使用者

很簡單,呼叫string.join方法就行:

string result=string.join("x",y);

其中x是你的分割字串,例如用,連線

其中y是你的陣列

4樓:

雖然我不太會c#,但是

把我的想法給你吧。

string arrtostr(char arr )return str;}

5樓:

實現位元組陣列至十六進位制字串轉換,這個操作在接收網路資料時非常有用,**嘛,就一行,就一行,就一行:

string str = bitconverter.tostring(bytes);

c#怎麼使一個string型的陣列變成字串

6樓:墨汁諾

實現位元組陣列至十六進位制字串轉換:

62616964757a686964616fe59b9ee7ad9431333433633437

string str = bitconverter.tostring(bytes);

呼叫string.join方法:

string result=string.join("x",y);

其中x是分割字串,

例如,連線其中y是陣列

string arrtostr(char arr )return str;}

7樓:四葉草的恬謐

陣列:string s = ;

①join轉換字串:string str1 = string.join(",", s);

②格式回化答

字串:string str2 = string.format(",,,,", s);

8樓:匿名使用者

string strs = new string[5];

strs[0] = "ad";

strs[1] = "bd";

strs[2] = "cd";

strs[3] = "dd";

strs[4] = "ed";

string str;

str= string.concat(strs);

好像是這樣

怎麼可能,string.concat(strs); 的返回型別是string型的啊

str的值是回adbdcddded,你測試下,答我試了的

9樓:匿名使用者

string型的數bai

組???

string本來就du

是字zhi符串

dao.字串陣列版

變字權符串????

string strs = new string[10];

string str = string.empty;

foreach(string tempstr in strs)

10樓:匿名使用者

肯定沒有。

一個是引用型別 ,一個是值型別

不能直接變換的。

11樓:匿名使用者

string sl = new string;

string s;

s = string.join("", sl);

測試過,bai結果為

duzhi:aabbcc

s = string.join(",", sl);

結果為:aa,bb,cc

這樣dao應該明白版了權吧

12樓:匿名使用者

直接用.tostring()方法就好了。

c#怎麼把byte陣列轉換為字串

13樓:

實現位元組陣列至十六進位制字串轉換,這個操作在接收網路資料時非常有用,**嘛,就一行,就一行,就一行:

string str = bitconverter.tostring(bytes);

14樓:司馬刀劍

有兩張方法:

方法一:

//字串轉byte

string stringmessage = "how are you?";

console.writeline("", stringmessage);

system.text.asciiencoding ascii = new system.text.asciiencoding();

byte bytesmessage = ascii.getbytes(stringmessage);

//byte轉字串

byte bytesmessage;

system.text.asciiencoding ascii = new system.text.asciiencoding();

string stringmessage = ascii.getstring( bytesmessage );

方法二:

//字串轉utf-8 byte

string stringmessage = "hello world how are you? pi /u03c0 yen /uffe5";

system.text.utf8encoding utf8 = new system.text.utf8encoding();

byte bytesmessage = utf8.getbytes(stringmessage);

//utf-8 byte 轉字串

byte bytesmessage;

system.text.utf8encoding utf8 = new system.text.utf8encoding();

string stringmessage = utf8.getstring( bytesmessage );

c#怎麼把一個int陣列轉成string陣列

15樓:匿名使用者

首先你先知道,int 是 如何轉換成 string 的:

用tostring

int varint = 1;

string varstring2 = varint.tostring();

或者convert.tostring()

int varint = 1;

string varstring = convert.tostring(varint);

根據以上的轉換,就能

回實現陣列的答轉換:

int a1 = ;

string a2 = new string[3];

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

a2[i] = a1[i].tostring();

16樓:

1、用循抄環:

int intarray=new int[99];

string stringarray=new stringarray[intarray.length];

for(int i=0;i().toarray();

希望對你有幫助,有疑問請追問或是hi

17樓:匿名使用者

int intarr = ;

string stringarr = new string[5];

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

18樓:匿名使用者

int 型別加 string

例子的話 就是

int i=10;

string s="";

string str=i+s;

19樓:匿名使用者

ebserserbser

c中怎麼定義字串陣列,C中怎麼定義字串陣列

方法一 string abc new string 3 abc 0 1 abc 1 2 abc 2 3 方法二 string abc new string 最笨的方法 string abc new string 4 abc 0 aaa abc 1 bbb abc 2 ccc abc 3 ddd st...

c語言中字串和陣列的區別,C語言中字串和陣列的區別

這個是字元陣列。c語言字元陣列和字串的區別,字元陣列是一個儲存字元的陣列,而字串是一個用雙括號括起來的以 0 結束的字元序列,雖然字串是儲存在字元陣列中的,但是一定要注意字串的結束標誌是 0 總的來說是沒有區別的,字串就是以字元陣列形式儲存的。可以把一個字串看成是一個字元陣列,可以按陣列那樣操作。兩...

c語言 陣列與字串 程式設計題,C語言 陣列與字串 程式設計題

include int s int a 100 100 int x,int y min a 0 k p 0 for j 0 j int main printf 對角線之和為 d n sum return 0 include int main for i 0 i printf 轉置矩陣為 n for ...