- 8
- 0
- 约1.03万字
- 约 15页
- 2016-12-09 发布于河南
- 举报
(C#)习题二(2013-03-12)
1. 编写一个控制台应用程序,接收一个长度大于3的字符串,完成下列功能
1) 输出字符串的长度。
2) 输出字符串中第一个出现字母a的位置。
3) 在字符串的第3个字符后面插入子串“hello”,输出新字符串。
4) 将字符串“hello”替换为“me”,输出新字符串。
5) 以字符“m”为分隔符,将字符串分离,并输出分离后的字符串。string str = this is a child;
Console.WriteLine(str.Length);
Console.WriteLine(str.IndexOf(a));
Console.WriteLine(str.Insert(8,not ));
Console.WriteLine(str.Replace(this,he));
string[] str1 = str.Split( );
for (int i = 0; i str.Length; i++)
{
Console.WriteLine(str[i]);
}
Console.ReadLine();
2. 编写一个
原创力文档

文档评论(0)