C#之字符串
2021-04-19 11:29
标签:play white height uri nta ring alt bsp onclick 1 Replace 2.ToLower() 全部小写 ToUpper()全部大写 3.Contains C#之字符串 标签:play white height uri nta ring alt bsp onclick 原文地址:https://www.cnblogs.com/zhangtaotqy/p/8671196.htmlstring sayHello = "Hello World!";
Console.WriteLine(sayHello);
sayHello = sayHello.Replace("Hello", "张涛");
Console.WriteLine(sayHello);
Hello World!
张涛 World!
string songLyrics = "You say goodbye, and I say hello";
Console.WriteLine(songLyrics.Contains("goodbye"));
Console.WriteLine(songLyrics.Contains("greetings"));
True
False
string songLyrics = "You say goodbye, and I say hello";
Console.WriteLine(songLyrics.StartsWith("You"));
Console.WriteLine(songLyrics.StartsWith("goodbye"));
Console.WriteLine(songLyrics.EndsWith("hello"));
Console.WriteLine(songLyrics.EndsWith("goodbye"));
True
False
True
False