String vs. Net String.endswith method (String)

Source: Internet
Author: User

String str= "web/abc.aspx";

if (str. EndsWith ("abc.aspx"))

{

This method compares value with a substring at the end of this instance, the same length as value, and returns an indication that they are equal. to be equal,value must be a reference to this same instance, or match the end of this instance.

This method performs a word (case-sensitive and culture) comparison using the current culture.

}

Else

{

Description of the caller

Such asAs described in best practices for using strings in the. NET Framework, we recommend that you avoid invoking a string comparison method that replaces the default value, but instead call a method that requires an explicit parameter to be specified. to use the string comparison rules of the current culture to determine whether a string begins with a specific substring, use StringComparison for its comparisonType parameter . the value of CurrentCulture calls the EndsWith (String, StringComparison) method overload.

}

String comparison to. Net String.endswith method (string)

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.