ʹÓÃC#ÕýÔò±í´ïʽƥÅäÏà¹Ø×Ö·û´®
C#ÕýÔò±í´ïʽƥÅä×Ö·û´®µÄ·½·¨ÈçÏ£º
1.ʹÓÃC#ÖÐʹÓÃÕýÔò±í´ïʽSystem.Text.RegularExpressionsÃüÃû¿Õ¼ä£»
2.ʹÓÃC#ÖÐʹÓÃÕýÔò±í´ïʽMatches()·½·¨Æ¥Åä×Ö·û´®£¬¸ñʽÈçÏ£º
MatchCollection Matches = Regex.Matches(Str, Pattern, RegexOptions.IgnoreCase | RegexOptions.ExplicitCapture);
ÆäÖÐStr±íʾÊäÈë×Ö·û´®£¬Pattern±íʾƥÅäģʽ£¬RegexOptions.IgnoreCase±íʾºöÂÔ´óСд£¬RegexOptions.ExplicitCapture±íʾ¸Ä±äÊÕ¼¯Æ¥Å䷽ʽ¡£
3.Æ¥Åä½á¹û±£´æÔÚMatchCollection¼¯ºÏÖУ¬¿ÉÒÔͨ¹ýÑ»·±éÀú½á¹û¼¯È¡³öMatch¶ÔÏóµÄ½á¹û¡£
TestRagular.cs:
using System;
using System.Text.RegularExpressions;
namespace Magci.Test.Strings
{
public class TestRegular
{
public static void WriteMatches(string str, MatchCollection matches)
{
Console.WriteLine("\nString is : " + str);
Console.WriteLine("No. of matches : " + matches.Count);
foreach (Match nextMatch in matches)
{
//È¡³öÆ¥Åä×Ö·û´®ºÍ×î¶à10¸öÍâΧ×Ö·û
int Index = nextMatch.Index;
string result = nextMatch.ToString();
&
Ïà¹ØÎĵµ£º
1.¾²Ì¬³ÉÔ±ºÍ·Ç¾²Ì¬³ÉÔ±µÄÇø±ð£¿
2.const ºÍ static readonly Çø±ð£¿
3.extern ÊÇʲôÒâ˼£¿
4.abstract ÊÇʲôÒâ˼£¿
5.internal ÐÞÊηûÆðʲô×÷Óã¿
6.sealed ÐÞÊηûÊǸÉʲôµÄ£¿
7.override ºÍ overload µÄÇø±ð£¿
8.ʲôÊÇË÷ÒýָʾÆ÷£¿
9.new ÐÞÊηûÊÇÆðʲô×÷Óã¿
10.this ¹Ø¼ü×ֵĺ¬Ò壿
11.¿ÉÒÔʹÓóéÏóº¯Ê ......
//TransmitFileʵÏÖÏÂÔØ
protected void Button1_Click(object sender, EventArgs e)
{
/*
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öÐµķ½·¨TransmitFileÀ´½â¾öʹÓÃRespo ......
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Threading;
namespace PortScanner
{
class Program
{
¡¡//ÒÑɨÃè¶Ë¿ÚÊýÄ¿
¡¡internal static int scannedCount = 0;
¡¡//ÕýÔÚÔËÐеÄÏß³ÌÊýÄ¿
¡¡internal static int ru ......
C#»Ï߿ؼþµÄÓ¦ÓÃʵÀý½éÉÜ֮ǰÎÒÃÇÒªÃ÷°×ÔÚC#ÖÐûÓлÏߵĿؼþ£¬ÕâÀïдÁËÒ»¸ö£¬´ó¼Ò·ÖÏí¡£¹²ÓÐÁ½¸ö¿Ø¼þ·Ö±ðÊÇ»ºáÏߺͻÊúÏߵ쬹ØÓÚÔõô»Ð±ÏßÓÐÐËȤµÄ¿ÉÒÔ×öÒ»¸ö´ó¼Ò·ÖÏí¡£
C#»Ï߿ؼþÖ®ºáÏß
using System;
using System.Collections;
using System.ComponentModel; ......