首页 > 代码库 > 第一次随堂测试
第一次随堂测试
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
string str = " The major reason for the good performance of the good algorithm is that the incorporation of the multhe tioperator strategy helps to select good crossover operators.";
Console.WriteLine(str.Length);
string[] str1 = str.Split(‘ ‘);
for (int a = 1; a < str1.Length; a++)
{
Console.Write(str1[a][0]+" ");
}
Console.WriteLine();
string str2 = str.Replace("of", "OF");
Console.WriteLine(str2);
int i = str.IndexOf(" tioperator");
string str3 = str.Remove(i, 11);
Console.WriteLine(str3);
int j = 0;
while (j < str.Length)
{
j = str.IndexOf("good", j);
if (j == -1)
{
break;
}
Console.WriteLine(j);
j++;
}
int k = str.IndexOf(" strategy");
string str4 = str.Insert(k, " the");
Console.WriteLine(str4);
}
}
}
第一次随堂测试