动态字符串[] [英] dynamic string[]

查看:80
本文介绍了动态字符串[]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被告知我可以拥有动态或静态字符串数组。


所以如果我宣布


string [] dynamic;


如何将元素添加到动态并调整大小?


---

发送邮件经过无病毒认证。

由AVG反病毒系统检查( http://www.grisoft.com)

版本:6.0.752 /病毒库:503 - 发布日期:2004年9月3日

解决方案

你不能 - 看看ArrayList。


-

Adam Clauss ca*****@tamu.edu

备用变更 < SP ********* @ spam.spam>在留言新闻中写道:ZX *************** @ newsread3.news.pas.earthlin k.net ...

我被告知我可以拥有一个动态或静态的字符串数组。

所以如果我声明

string []动态;

如何添加元素到动态并调整大小?

---
发送的邮件经过无病毒认证。
由AVG反病毒系统检查( http://www.grisoft.com)
版本:6.0.752 /病毒库:503 - 发布日期:9 / 3/2004



试试Sytem.Text.StringBuilder


Marijan

备用变更 < SP ********* @ spam.spam>在消息中写道

新闻:ZX *************** @ newsread3.news.pas.earthlin k.net ...

我被告知我可以有一个动态或静态的字符串数组。

所以如果我声明

string []动态;

怎么做我添加了动态元素并调整大小?


---发送邮件经过无病毒认证。
由AVG反病毒系统检查( http://www.grisoft.com)
版本:6.0.752 /病毒数据库:503 - 发布日期:2004年9月3日






我去了一个调整大小的例行程序。


foreach(在mc1中匹配m1)

{

temp = new string [i + 1];

anchors.CopyTo(temp,0);

temp [i ++] = fileName +"#" + m1.Value.Substring(5,m1.Length- 5);

anchors = temp;

}

Marijan Tadin写道:

试试Syte m.Text.StringBuilder

Marijan

" Spare Change" < SP ********* @ spam.spam>在消息中写道
新闻:ZX *************** @ newsread3.news.pas.earthlin k.net ...

我被告知我可以有一个动态或静态的字符串数组。

所以如果我声明

string []动态;

如何添加元素到动态并调整大小?


---
发送邮件经过无病毒认证。
由AVG反病毒系统检查( http://www.grisoft.com)
版本:6.0.752 /病毒数据库:503 - 发布日期:2004年9月3日




-

隐身 http://kentpsychedelic.blogspot.com

新增材料9/5


I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004

解决方案

You can''t - check out ArrayList.

--
Adam Clauss
ca*****@tamu.edu
"Spare Change" <sp*********@spam.spam> wrote in message news:ZX***************@newsread3.news.pas.earthlin k.net...

I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004



Try Sytem.Text.StringBuilder

Marijan
"Spare Change" <sp*********@spam.spam> wrote in message
news:ZX***************@newsread3.news.pas.earthlin k.net...

I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004





I went with a resizing routine.

foreach(Match m1 in mc1)
{
temp = new string[i+1];
anchors.CopyTo(temp,0);
temp[i++]=fileName+"#"+m1.Value.Substring(5,m1.Length-5);
anchors=temp;
}
Marijan Tadin wrote:

Try Sytem.Text.StringBuilder

Marijan
"Spare Change" <sp*********@spam.spam> wrote in message
news:ZX***************@newsread3.news.pas.earthlin k.net...

I am told that I can have a dynamic or static string array.

So if I declare

string[] dynamic;

How do I add elements to dynamic and resize it ?


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.752 / Virus Database: 503 - Release Date: 9/3/2004



--
incognito http://kentpsychedelic.blogspot.com
new material added 9/5


这篇关于动态字符串[]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆