统一归档20260319
This commit is contained in:
11
CS/lab10/10_6/10_6.csproj
Normal file
11
CS/lab10/10_6/10_6.csproj
Normal file
@@ -0,0 +1,11 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>_10_6</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
25
CS/lab10/10_6/10_6.sln
Normal file
25
CS/lab10/10_6/10_6.sln
Normal file
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.14.36717.8 d17.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "10_6", "10_6.csproj", "{F80AAAC0-0F05-41E5-B997-711801DF2CE6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F80AAAC0-0F05-41E5-B997-711801DF2CE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {DA93D3A7-7043-403E-8699-6F103B98507C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
30
CS/lab10/10_6/Program.cs
Normal file
30
CS/lab10/10_6/Program.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace _10_6
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// 验证中国电话号码
|
||||
string pattern = @"(\^(\d{3}\ )|\d{3}-)?\d{8}$";
|
||||
Console.WriteLine("请输入字符串(中国电话号码)");
|
||||
string s = Console.ReadLine();
|
||||
bool b1 = Regex.IsMatch(s, pattern);
|
||||
Console.WriteLine("{0}是有效的中国电话号码吗? {1}", s, b1);
|
||||
// 验证邮政编码
|
||||
pattern = @"^\d{6}$";
|
||||
Console.WriteLine("请输入字符串(邮政编码)");
|
||||
s = Console.ReadLine();
|
||||
bool b2 = Regex.IsMatch(s, pattern);
|
||||
Console.WriteLine("{0}是有效的邮政编码吗? {1}", s, b2);
|
||||
// 有效URL地址
|
||||
pattern = @"^http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?$";
|
||||
Console.WriteLine("请输入字符串(URL地址)");
|
||||
s = Console.ReadLine();
|
||||
bool b3 = Regex.IsMatch(s, pattern);
|
||||
Console.WriteLine("{0}是有效的URL地址吗? {1}", s, b3);
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
CS/lab10/10_6/屏幕截图 2025-11-28 171411.png
Normal file
BIN
CS/lab10/10_6/屏幕截图 2025-11-28 171411.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 59 KiB |
Reference in New Issue
Block a user