Archives

Zed Developer

zed development is comprised of a team of highly qualified and self motivated individuals. The passion which each member holds for their work allows us to be a major asset to IT firm; whether they are looking for a one-off service or a longer relationship in order to build their firm through use of our dedicated marketing department.

APS.Net 2.0. C# provides the functionality to compare the two string using Compare Function. It has some overloaded functions also that provide additional features to compare the strings in ASP.Net based on Culture and Case sensitive aspects and u can also compare substrings of the provided two strings using the overloaded function of C# string.Compare function. C# string compare function returns the integer value based on the lexical relationship between the two strings. It returns 0 if both strings are equal.



APS.Net 2.0. C# provides the functionality to compare the two string using Compare Function. It has some overloaded functions also that provide additional features to compare the strings in ASP.Net based on Culture and Case sensitive aspects and u can also compare substrings of the provided two strings using the overloaded function of C# string.Compare function. C# string compare function returns the integer value based on the lexical relationship between the two strings. It returns 0 if both strings are equal.



  • public static int Compare(string strA, string strB);

  • public static int Compare(string strA, string strB, bool ignoreCase);

  • public static int Compare(string strA, string strB, StringComparison comparisonType);

  • public static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture);

  • public static int Compare(string strA, int indexA, string strB, int indexB, int length);

  • public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase);

  • public static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType);

  • public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture);

Above overloads of string.Compare function accepts different types of parameter values to compare the two strings, substrings of specific length, case sensitive comparison or culture based comparison. C# string compare function returns 0 if strings are equal. It returns value less than 0 i.e. -1, if first string is less than second one. C# string function returns the value greater than 0 i.e. 1, if the first string is greater than second string value passed to the compare function.

Examples of Asp.Net C# string Compare function

Following are examples based on the overloaded functions of C# string compare:


string strA, strB;

Example 1:

strA = "ASP.Net C# string.Compare function"; strB = "ASP.Net C# string.Compare function";

Response.Write(string.Compare(strA, strB) + "<br />");

Output:

0

Example 2:

strA = "string value 1"; strB = "strB";

Response.Write(string.Compare(strA, strB) + "<br />");

Output:

1

Example 3:


strA = "strA"; strB = "string value 2";

Response.Write(string.Compare(strA, strB) + "<br />");

Output:

-1

Example 4:

strA = "compare strings"; strB = "COMPARE STRINGS";

Response.Write(string.Compare(strA, strB, true) + "<br />");

Output:

0

Example 5:


strA = "compare strings"; strB = "COMPARE STRINGS";

Response.Write(string.Compare(strA, strB, StringComparison.CurrentCultureIgnoreCase) + "<br />");

Output:

0

Example 6:


strA = "compare strings"; strB = "COMPARE STRINGS"; Response.Write(string.Compare(strA, strB, true, System.Globalization.CultureInfo.CurrentCulture) + "<br />");

Output:

0

Example 7:


strA = "compare strings"; strB = "COMPARE STRINGS";

Response.Write(string.Compare(strA, 8, strB, 8, 7) + "<br />");

Output:

-1

Example 8:


strA = "compare strings"; strB = "COMPARE STRINGS";

Response.Write(string.Compare(strA, 8, strB, 8, 7, true) + "<br />");

Output:

0

Example 9:


strA = "compare strings"; strB = "COMPARE STRINGS";

Response.Write(string.Compare(strA, 8, strB, 8, 7, StringComparison.CurrentCultureIgnoreCase) + "<br />");

Output:

0

Example 10:


strA = "compare strings"; strB = "COMPARE STRINGS";

Response.Write(string.Compare(strA, 8, strB, 8, 7, true, System.Globalization.CultureInfo.CurrentCulture) + "<br />");

Output:

0


If you have any query than feel free to add comment.

Search engine optimization (SEO) is the process of improving the intensity and quality of traffic to a web site from search engines via “natural” (organic) search results for targeted keywords. 

Basically there are main two ways to do SEO: one is On-page optimization and other is Off-page optimization

Now here I will explain  something about on page optimization: 

On-page optimization is a technique of web page optimization. You can make a web page more search engine friendly by using this method. Once your web page is optimized, the search engines will drive targeted or relevant traffic to your web page. 

Here are some tips that will help you in on-page optimization: 

Ø  Domain name: Try to have a domain name that has the most important targeted keyword.

Ø  Title: Use variations of your targeted keywords in the title. In case you need branding, you may keep the company name at the end of your web site title.

Ø  Internal navigation: Ensure an easy internal navigation between your web pages. You can put a sitemap so that visitors can reach any page with ease. If you feel that any particular page of your web site is more important than the others, isolate it and get more links pointing to it.

Ø  H1 and H2 tags: Use your targeted keywords in these tags in a logical way and define them in the CSS file.

Ø  Meta description: Put your targeted keywords in the beginning and call for an action in the end.

Ø  Minimum word limit of a page: Don't put too much or too little text in your web page. Try to have at least 250 words on each of your web pages.

Ø  Proper use of image ALT tags: You can use your targeted keywords in the image ALT tags.

Ø  Use of strong tag: To put emphasis on the keywords, use the strong tag instead of the bold tag.

Ø  Proper distribution of the keywords: Spread out your targeted keywords throughout the body of your content. Don't go for a keyword density that's too high or else, it may look spamming.

Ø  Validate your code: It is advisable to get your web site codes validated by W3C so that it's easier for the SE spiders to crawl your web site.

Hello My Developer Friends....

I have created this blog to share your ideas and knowledge to help others.Please feel free to Share your views in Developers Chat.I will add the post for you.You can also email me for specific requirement.If you like this blog than subscribe to our RSS.
Any suggestion is welcome...


Hope you will help us to improve.....

Thanks,
Zed Developer

Hello there,

We have completed the blog layout and we are launching soon.....

Categories