将输入的string中的"yes" 改为"no"
2014-07-17 16:36
435 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Csharp
{
class
Program
{
static void Main(string[] args)
{
string myString = Console.ReadLine();
string [] myWords = myString.Split(' ');
foreach (string word in myWords)
Console.Write("{0} ", (word == "yes") ? "no" : word);
Console.WriteLine();
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Csharp
{
class
Program
{
static void Main(string[] args)
{
string myString = Console.ReadLine();
string [] myWords = myString.Split(' ');
foreach (string word in myWords)
Console.Write("{0} ", (word == "yes") ? "no" : word);
Console.WriteLine();
Console.ReadKey();
}
}
}
相关文章推荐
- 将输入的string中"yes" 改为 "no"
- The string &quot…
- "Yes" or "No"
- "Yes" or "No"铪铪铪
- "Yes" or "No"铪铪铪
- C#使用String.Format()方法时,出现异常"输入的字符串格式有误"的解决方法
- "Unable to find record. No key specified"错误分析及解决办法
- 使用String.Format()方法时,作为普通字符的"{"和"}"要写成"{{"和"}}"。
- "current buffer has no process" 问题解决
- StringBuffer的"append" 和 String的"+"用来连接字符串哪个好些?
- No tag " " defined in tag library imported with prefix="s"
- "无法定位程序输入点_except_handler4_common于动态连接库msvcrt.dll"
- "Fatal Error[Cp001]: Copy protection check, No valid license found for this product [24] ".
- "ERROR:Malformed string"错误的解决方法
- "There" is no better than "Here
- 如何将java中的"/"替换为"/"以及replaceAll(String regex, String replacement) 注意事项
- String.split方法对"."分割的处理
- "无法连接到打印机。 您或者输入打印机名不正确, 或指定打印机是否不再连接到服务器。"错误提示的解决
- "" 和string.empty的区别
- "There" is no better than "Here"知足常乐