MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / V_strnicmp

Function V_strnicmp

src/vstdlib/strtools.cpp:129–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129int V_strnicmp( const char *s1, const char *s2, int n )
130{
131 Assert( n >= 0 );
132 Assert( n == 0 || s1 != NULL );
133 Assert( n == 0 || s2 != NULL );
134
135 while ( n-- > 0 )
136 {
137 int c1 = *s1++;
138 int c2 = *s2++;
139
140 if ( c1 != c2 )
141 {
142 if ( c1 >= 'a' && c1 <= 'z' )
143 c1 -= ('a' - 'A');
144 if ( c2 >= 'a' && c2 <= 'z' )
145 c2 -= ( 'a' - 'A' );
146 if ( c1 != c2 )
147 return c1 < c2 ? -1 : 1;
148 }
149 if ( c1 == '\0' )
150 return 0; // null terminator hit - strings the same
151 }
152
153 return 0; // n characters compared the same
154}
155
156//-----------------------------------------------------------------------------
157// Finds a string in another string with a case insensitive test

Callers 6

V_stricmpFunction · 0.85
BParsePEMHeaderOrFooterFunction · 0.85
CheckInitICEMethod · 0.85
FindNextTestMethod · 0.85
GetBinaryBlobMethod · 0.85

Calls

no outgoing calls

Tested by 2

FindNextTestMethod · 0.68
GetBinaryBlobMethod · 0.68