IT Community - Software Programming, Web Development and Technical Support

What is diffrenece between string.compare and string.compareordinal

This is a discussion on What is diffrenece between string.compare and string.compareordinal within the ASP and ASP.NET Programming forums, part of the Web Development category; hi What is diffrenece between string.compare and string.compareordinal?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 12-28-2007, 02:51 AM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default What is diffrenece between string.compare and string.compareordinal

hi
What is diffrenece between string.compare and string.compareordinal?
__________________
Shaalini.S
Be the Best of Whatever you are...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-28-2007, 02:59 AM
bluesky bluesky is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 201
bluesky is on a distinguished road
Default Re: What is diffrenece between string.compare and string.compareordinal

String.Compare can be or not be case-sensitive, and can incorporate anynumber of comparison options, including culture-sensitivity and sortingrules. That is, it is not comparing the exact strings necessarily, but canbe configured to do various sorts of comparisons. String.CompareOrdinalcompares the numeric values of the individual Unicode characters of thestrings. In other words, it is always case-sensitive, and neverculture-sensitive.

String.CompareOrdinal is faster (more efficient) when you don't need to do aculture-sensitive comparison, and you do want to do a case-sensitivecomparison.String.CompareTo is case-sensitive, using an Ordinal comparison, andculture-sensitive, but always uses the current culture. It is faster thanString.Compare, but less efficient than String.CompareOrdinal.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 12-28-2007, 03:07 AM
bluesky bluesky is offline
D-Web Analyst
 
Join Date: Jun 2007
Posts: 201
bluesky is on a distinguished road
Default take ScreenShot in C#

To create a screenshot in c# we need to use drawing api of the .net framework
First you have import System.Drawing.Imaging name space with following code...

using System.Drawing.Imaging;

here is the code in C# for screenshot.

Rectangle bounds = Screen.GetBounds(Point.Empty);
using(Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using(Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
}
bitmap.Save("test.jpg", ImageFormat.Jpeg);
}
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 12-28-2007, 10:46 PM
rrrajesh84in rrrajesh84in is offline
D-Web Master
 
Join Date: Mar 2007
Posts: 399
rrrajesh84in is on a distinguished road
Default Re: What is diffrenece between string.compare and string.compareordinal

Compare


The String.Compare method provides a thorough way of comparing the current string object to another string or object. This method is culturally aware. You can use this function to compare two strings or substrings of two strings. Additionally, overloads are provided that regard or disregard case and cultural variance. The following table shows the three integer values that might be returned by this method.

The following code example uses the Compare method to determine the relative values of two strings.
[ VB ]
Dim myString As String = "Hello World!"
Console.WriteLine ( [ String ] .Compare ( myString, "Hello World?" ) )
[ C# ]
string myString = "Hello World!";
Console.WriteLine ( String.Compare ( myString, "Hello World?" ) ); This example displays -1 to the console.
CompareOrdinal


The String.CompareOrdinal method compares two string objects without considering the local culture. The return values of this method are identical to the values returned by the Compare method in the previous table.
The following code example uses the CompareOrdinal method to compare the values of two strings.
[ VB ]
Dim myString As String = "Hello World!"
Console.WriteLine ( String.CompareOrdinal ( myString, "hello world!" ) )
[ C# ]
string myString = "Hello World!";
Console.WriteLine ( String.CompareOrdinal ( myString, "hello world!" ) ); This example displays -32 to the console.
__________________
.....................................
''''''
Rajesh''''''
Ants. . . . . . Like me
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compare the string with case sensitive in sql server? krishnakumar Database Support 9 10-10-2008 04:54 AM
Convert String to Date: new Date(string) oxygen Flash Actionscript Programming 3 03-07-2008 09:24 PM
Compare a string with String Array. oxygen C# Programming 5 12-28-2007 11:18 PM
How can I compare a date in a string with todays date? itbarota HTML, CSS and Javascript Coding Techniques 2 12-18-2007 11:02 PM
How to split a string by using a string usually in the c# dotnet... Archer C# Programming 1 07-25-2007 03:26 AM


All times are GMT -7. The time now is 07:24 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0