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?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi What is diffrenece between string.compare and string.compareordinal?
__________________ Shaalini.S ![]() Be the Best of Whatever you are... |
| Sponsored Links |
| |||
| 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. |
| |||
| 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); } |
| |||
| 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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |