mirror of
https://github.com/copyrighttxt/watrbx-game-engine.git
synced 2026-09-06 05:37:48 +00:00
GEEKING
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/* Copyright 2003-2005 ROBLOX Corporation, All Rights Reserved */
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef Rbx_strcasestr
|
||||
namespace RBX
|
||||
{
|
||||
|
||||
/* GCC often has strcasestr(); if not, you can use the following */
|
||||
|
||||
/* borrowed these definitions from Apache */
|
||||
#define ap_tolower(c) (tolower(((unsigned char)(c))))
|
||||
#define ap_toupper(c) (toupper(((unsigned char)(c))))
|
||||
|
||||
static const char *Rbx_strcasestr( const char *h, const char *n )
|
||||
{
|
||||
if( !h || !*h || !n || !*n ) { return 0; }
|
||||
char *a= (char*)h, *e=(char*)n;
|
||||
while( *a && *e ) {
|
||||
if( ap_toupper(*a) != ap_toupper(*e) ) {
|
||||
++h; a=(char*)h; e=(char*)n;
|
||||
} else {
|
||||
++a; ++e;
|
||||
}
|
||||
}
|
||||
return (const char *)(*e) ? 0 : h;
|
||||
|
||||
}
|
||||
static inline const char *Rbx_strcasestr( const char *h, char *n )
|
||||
{
|
||||
return Rbx_strcasestr( h, static_cast<const char*>(n));
|
||||
}
|
||||
|
||||
static inline const char *Rbx_strcasestr( char *h, const char *n )
|
||||
{
|
||||
return Rbx_strcasestr( static_cast<const char*>(h), n);
|
||||
}
|
||||
}
|
||||
#endif // defined Rbx_strcasestr
|
||||
|
||||
Reference in New Issue
Block a user