C# equivalent strnicmp function in C language. It accepts two input strings along with the number of positions of chars to compare.
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.
DaveeditedPosted Feb 27, 2009, 2:15 PMEdited Feb 27, 2009, 2:17 PM
public int strnicmp(string s1, string s2, int n) { // param validation omitted for clarity return String.Compare(s1.Substring(0, n), s2.Substring(0, n), true); }