SIGN UP MEMBER LOGIN:    
ARTICLE

strnicmp equivalent in C#

Posted by gary sun Articles | String in C# August 07, 2001
C# equivalent strnicmp function in C language.
Reader Level:
Download Files:
 

C# equivalent strnicmp function in C language.  It accepts two input strings along with the number of positions of chars to compare.  

Login to add your contents and source code to this article
share this article :
post comment
 


Ah OK, then you can invoke that method by importing the Win32 library and invoking the method

Posted by Bechir Bejaoui Mar 01, 2009

I was talking about being able to invoke the version of _strnicmp() that's already in the Win32 C runtime lib.

http://msdn.microsoft.com/en-us/library/chd90w8e(VS.80).aspx

Posted by Dave Mar 01, 2009


suppose that you have this native library called C_Library.dll written in C and you want to use it within your C# code

using System;
using System.Runtime.InteropServices;

namespace Project
{
class Program
{
[DllImport("
C_Library.dll")]
public static extern int
strnicmp(string s1, string s2, int n);

static void Main(string[] args)
{
Console.WriteLine(
strnicmp("Bechir", "Bejaoui", 2))
);
}
}
}




 

Posted by Bechir Bejaoui Mar 01, 2009

Sample code?

Posted by Dave Mar 01, 2009


We can use thestrnicmp it self without converting it by using the COM interop API provided by the .Net framework

Posted by Bechir Bejaoui Feb 28, 2009
Nevron Gauge for SharePoint
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites - Click Here!
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor