startsends.cs

来自「vc的原码例子12 vc的原码例子12」· CS 代码 · 共 30 行

CS
30
字号
using System;

class clsStartsEnds
{
	static void Main()
	{
		string Office1 = "Houston, Texas 77479";
		string Office2 = "Las Vegas, Nevada 85023";

		if (Office1.StartsWith("Houston"))
			Console.WriteLine("{0} starts with Houston", Office1);
		else
			Console.WriteLine("{0} does not start with Houston", Office1);

		if (Office2.StartsWith("Houston"))
			Console.WriteLine("{0} starts with Houston", Office2);
		else
			Console.WriteLine("{0} does not start with Houston", Office2);

		if (Office1.EndsWith("85023"))
			Console.WriteLine("{0} ends with 85023", Office1);
		else
			Console.WriteLine("{0} does not end with 85023", Office1);

		if (Office2.EndsWith("85023"))
			Console.WriteLine("{0} ends with 85023", Office2);
		else
			Console.WriteLine("{0} does not end with 85023", Office2);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?