ARTICLE

strnicmp equivalent in C#

Posted by gary sun Articles | String in C# August 07, 2001
C# equivalent strnicmp function in C language. It accepts two input strings along with the number of positions of chars to compare.
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
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
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Get Career Advice from Experts