| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 436 人关注过本帖
标题:求助——代码解析
只看楼主 加入收藏
LQHJ
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2007-6-8
收藏
 问题点数:0 回复次数:1 
求助——代码解析

这段代码我还有些地方读不懂,哪位好心人可以帮我注释下吗?谢谢!
using namespace System;

int main()
{
String^ delimStr = " ,.:\t";
Console::WriteLine( "delimiter : '{0}'", delimStr );
array<Char>^ delimiter = delimStr->ToCharArray( );
array<String^>^ words;
String^ line = "one\ttwo three:four,five six seven";

Console::WriteLine( "text : '{0}'", line );
words = line->Split( delimiter );
Console::WriteLine( "Number of Words : {0}", words->Length );
for (int word=0; word<words->Length; word++)
Console::WriteLine( "{0}", words[word] );

return 0;
}

搜索更多相关主题的帖子: 代码 解析 
2007-06-15 14:37
Arcticanimal
Rank: 3Rank: 3
等 级:论坛游民
威 望:7
帖 子:341
专家分:20
注 册:2007-3-17
收藏
得分:0 
回复:(LQHJ)求助——代码解析
这段代码是C++和C#的杂和!!!!
using namespace System;
int main()
{
String delimStr = " ,.:\t";
Console::WriteLine( "delimiter : '{0}'", delimStr );//应该是Console.WriteLine("delimiter : '{0}'",delimStr)C#里面没有域限制符"::"
array<Char> delimiter = delimStr->ToCharArray( );//C#里面用指针应该在 unsafe{}里,并且这里不应该用指针
array<String> words;
String^ line = "one\ttwo three:four,five six seven";

Console::WriteLine( "text : '{0}'", line );//error!
words = line->Split( delimiter );//!!
Console::WriteLine( "Number of Words : {0}", words->Length );//!!
for (int word=0; word<words->Length; word++)
Console::WriteLine( "{0}", words[word] );

return 0;
}


try new catch
2007-06-15 16:42
快速回复:求助——代码解析
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022071 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved