为什么这个do while事件没有用啊

string s = Console.ReadLine();
do
{
#region
if (num == 1)
{
Console.WriteLine("请输入要哪里追加的字符串是什么");
int index = Convert.ToInt32(Console.ReadLine());
string newword = Console.ReadLine();
sb.Insert(index, newword);
sb.AppendLine();
Console.WriteLine(sb);
Console.WriteLine("继续?(y/n)");
}
else if (num == 2)
{
Console.WriteLine("请输入要提取的字符串的位置和个数");
int index = Convert.ToInt32(Console.ReadLine());
int coun = Convert.ToInt32(Console.ReadLine());
string input = sb.ToString();
Console.WriteLine(input.Substring(index, coun));
Console.WriteLine("继续?(y/n)");

            }
            else if (num == 3)
            {
                Console.WriteLine("请输入要替换的字符串:");
                string word = Console.ReadLine();
                Console.WriteLine("替换为:");
                string newword = Console.ReadLine();
                sb.Replace(word, newword);
                Console.WriteLine("替换后结果:{0}",sb);
                Console.WriteLine("继续?(y/n)");

            }
            else if (num == 4)
            {
                string patter = @"(\d+)|([a-z])";
                string word = sb.ToString();
                if (Regex.IsMatch(word, patter))
                {
                    Console.WriteLine("包含了非汉字");
                }
                else
                {
                    Console.WriteLine("不包含数字和小写字母");
                }
                Console.WriteLine("继续?(y/n)");
               ;
            }
            else if (num == 5)
            {
                Console.WriteLine("请输入要移除的指定位子:");
                int index = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("删除的个数");
                int c = Convert.ToInt32(Console.ReadLine());
                sb.Remove(index, c);
                Console.WriteLine("删除后的结果:{0}", sb);
                Console.WriteLine("继续?(y/n)");

            }
            else
            {
                Console.WriteLine("不包含该操作");
            }

            #endregion
        } while (s == "y"||s=="Y");
查看全部
qq_34418970
想飞的鱼丶
2016/05/15 10:26
  • 点赞
  • 收藏
  • 回答
    私信

4个回复