1 Star 0 Fork 0

猪头痴人/LearnCSharp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LearnString.cs 1.88 KB
一键复制 编辑 原始数据 按行查看 历史
ronal 提交于 2021-11-06 06:59 . 添加项目文件。
using System;
namespace LearnCSharp_1
{
class LearnString
{
static void Main_String(string[] args)
{
Console.WriteLine("Hello World!");
Console.ReadKey();
string aFriend = "Bill";
Console.WriteLine("Hello " + aFriend);
Console.ReadKey();
Console.WriteLine($"Hello {aFriend}");
Console.ReadKey();
string firstFriend = "Maria";
string secondFriend = "Sage";
Console.WriteLine($"The name {firstFriend} has {firstFriend.Length} letters.");
Console.WriteLine($"The name {secondFriend} has {secondFriend.Length} letters.");
Console.ReadKey();
string greeting = " Hello world! ";
Console.WriteLine($"[{greeting}]");
string trimmedGreeting = greeting.TrimStart();
Console.WriteLine($"[{trimmedGreeting}]");
trimmedGreeting = greeting.TrimEnd();
Console.WriteLine($"[{trimmedGreeting}]");
trimmedGreeting = greeting.Trim();
Console.WriteLine($"[{trimmedGreeting}]");
Console.ReadKey();
string sayHello = "Hello World";
Console.WriteLine(sayHello);
sayHello = sayHello.Replace("Hello", "Greetings");
Console.WriteLine(sayHello);
Console.ReadKey();
Console.WriteLine(sayHello.ToUpper());
Console.WriteLine(sayHello.ToLower());
Console.ReadLine();
string songLyrics = "You say goodbye, and I say hello";
Console.WriteLine(songLyrics.Contains("goodbye"));
Console.WriteLine(songLyrics.Contains("greetings"));
Console.ReadKey();
Console.WriteLine(songLyrics.EndsWith("hello"));
Console.WriteLine(songLyrics.EndsWith("goodbye"));
Console.ReadKey();
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ZhuTouChiRen/learn-csharp.git
git@gitee.com:ZhuTouChiRen/learn-csharp.git
ZhuTouChiRen
learn-csharp
LearnCSharp
master

搜索帮助