C#之字符串
阿新 • • 發佈:2018-03-29
say courier pre 分享圖片 圖片 and ola gpo start
1 Replace
string sayHello = "Hello World!"; Console.WriteLine(sayHello); sayHello = sayHello.Replace("Hello", "張濤"); Console.WriteLine(sayHello); Hello World! 張濤 World!Replace
2.ToLower() 全部小寫
ToUpper()全部大寫
3.Contains
string songLyrics = "You say goodbye, and I say helloContains()"; 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
C#之字符串