C # after-school mini-Test 5

Source: Internet
Author: User

1.string Correlation function

I tried the compare substring split function separately, as shown.

The Compare function compares the input to two strings, and then returns an int value to display the result.

SUBSTRING can read a portion of a string (starting index, number of indexes).

Split can split a string according to the given condition.

2. Regular expressions

Consists of metacharacters and literals, which are used to manage strings more conveniently.

For this part of the big study I refer to the http://www.wangqi.com/n9250c53.aspx

3.ecpection

Expection is to deal with predictable but unavoidable problems.

If you find the code snippet that handles exception in the appropriate method,

It will be called to process the exception.

If not found, expand the call stack to the previous layer to find the appropriate exception handler

public class Test

{

public static void Main ()

{

Console.WriteLine ("Enter Main ...");

Test T = new Test ();

T.func1 ();

Console.WriteLine ("Exit Main ...");

}

public void Func1 ()

{

Console.WriteLine ("Enter Func1 ...");

FUNC2 ();

Console.WriteLine ("Exit Func1 ...");

}

public void Func2 ()

{

Console.WriteLine ("Enter Func2 ...");

throw new System.ApplicationException ();

Console.WriteLine ("Exit Func2 ...");

}

}

}

Output:

Enter Main ...

Enter Func1 ...

Enter Func2 ...

It is important to note that if there are multiple exception and there are derivations between them, be sure to arrange the exception in order from special to General D.

C # after-school mini-Test 5

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.