mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-26 19:00:53 +00:00
Fixed: #888 CSString::find and CSString::findNS broken
This commit is contained in:
parent
e8d80432ba
commit
538f7abb14
2 changed files with 16 additions and 16 deletions
|
@ -333,10 +333,10 @@ public:
|
|||
CSString replace(const char *toFind,const char *replacement) const;
|
||||
|
||||
/// Find index at which a sub-string starts (case not sensitive) - if sub-string not found then returns string::npos
|
||||
unsigned find(const char *toFind,unsigned startLocation=0) const;
|
||||
std::string::size_type find(const char *toFind, std::string::size_type startLocation=0) const;
|
||||
|
||||
/// Find index at which a sub-string starts (case NOT sensitive) - if sub-string not found then returns string::npos
|
||||
unsigned findNS(const char *toFind,unsigned startLocation=0) const;
|
||||
std::string::size_type findNS(const char *toFind, std::string::size_type startLocation=0) const;
|
||||
|
||||
/// Return true if this contains given sub string
|
||||
bool contains(const char *toFind) const;
|
||||
|
@ -346,8 +346,8 @@ public:
|
|||
|
||||
/// Handy atoi routines...
|
||||
int atoi() const;
|
||||
signed atosi() const;
|
||||
unsigned atoui() const;
|
||||
sint32 atosi() const;
|
||||
uint32 atoui() const;
|
||||
sint64 atoi64() const;
|
||||
sint64 atosi64() const;
|
||||
uint64 atoui64() const;
|
||||
|
|
|
@ -1325,7 +1325,7 @@ namespace NLMISC
|
|||
if (toFind==NULL || *toFind==0)
|
||||
return *this;
|
||||
|
||||
unsigned i,j;
|
||||
std::string::size_type i,j;
|
||||
CSString result;
|
||||
for (i=0;i<size();)
|
||||
{
|
||||
|
@ -1349,15 +1349,15 @@ namespace NLMISC
|
|||
return result;
|
||||
}
|
||||
|
||||
unsigned CSString::find(const char *toFind,unsigned startLocation) const
|
||||
std::string::size_type CSString::find(const char *toFind, std::string::size_type startLocation) const
|
||||
{
|
||||
// const char *constStr = c_str();
|
||||
|
||||
// just bypass the problems that can cause a crash...
|
||||
if (toFind==NULL || *toFind==0 || startLocation>=size())
|
||||
return (unsigned)std::string::npos;
|
||||
return std::string::npos;
|
||||
|
||||
unsigned i,j;
|
||||
std::string::size_type i,j;
|
||||
for (i=startLocation;i<size();++i)
|
||||
{
|
||||
// string compare toFind against (*this)+i ...
|
||||
|
@ -1368,19 +1368,19 @@ namespace NLMISC
|
|||
if (toFind[j]==0)
|
||||
return i;
|
||||
}
|
||||
return (unsigned)std::string::npos;
|
||||
return std::string::npos;
|
||||
}
|
||||
|
||||
/// Find index at which a sub-string starts (case NOT sensitive) - if sub-string not found then returns string::npos
|
||||
unsigned CSString::findNS(const char *toFind,unsigned startLocation) const
|
||||
std::string::size_type CSString::findNS(const char *toFind, std::string::size_type startLocation) const
|
||||
{
|
||||
const char *constStr = c_str();
|
||||
|
||||
// just bypass the problems that can cause a crash...
|
||||
if (toFind==NULL || *toFind==0 || startLocation>=size())
|
||||
return (unsigned)std::string::npos;
|
||||
return std::string::npos;
|
||||
|
||||
unsigned i,j;
|
||||
std::string::size_type i,j;
|
||||
for (i=startLocation;i<size();++i)
|
||||
{
|
||||
// string compare toFind against (*this)+i ...
|
||||
|
@ -1391,12 +1391,12 @@ namespace NLMISC
|
|||
if (toFind[j]==0)
|
||||
return i;
|
||||
}
|
||||
return (unsigned)std::string::npos;
|
||||
return std::string::npos;
|
||||
}
|
||||
|
||||
bool CSString::contains(const char *toFind) const
|
||||
{
|
||||
return find(toFind)!=(unsigned)std::string::npos;
|
||||
return find(toFind)!=std::string::npos;
|
||||
}
|
||||
|
||||
bool CSString::contains(int character) const
|
||||
|
@ -1482,7 +1482,7 @@ namespace NLMISC
|
|||
return neg? -(sint32)result: (sint32)result;
|
||||
}
|
||||
|
||||
int CSString::atosi() const
|
||||
sint32 CSString::atosi() const
|
||||
{
|
||||
if (empty())
|
||||
return 0;
|
||||
|
@ -1533,7 +1533,7 @@ namespace NLMISC
|
|||
return neg? -(sint32)result: (sint32)result;
|
||||
}
|
||||
|
||||
unsigned CSString::atoui() const
|
||||
uint32 CSString::atoui() const
|
||||
{
|
||||
uint32 result=0;
|
||||
for (const_iterator it=begin();it!=end();++it)
|
||||
|
|
Loading…
Reference in a new issue