implement wxString:IsXXX() methods using iterators
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45477 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1604,34 +1604,43 @@ size_t wxString::Replace(const wxString& strOld,
|
|||||||
|
|
||||||
bool wxString::IsAscii() const
|
bool wxString::IsAscii() const
|
||||||
{
|
{
|
||||||
const wxChar *s = (const wxChar*) *this;
|
for ( const_iterator i = begin(); i != end(); ++i )
|
||||||
while(*s){
|
{
|
||||||
if(!isascii(*s)) return(false);
|
if ( !(*i).IsAscii() )
|
||||||
s++;
|
return false;
|
||||||
}
|
}
|
||||||
return(true);
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxString::IsWord() const
|
bool wxString::IsWord() const
|
||||||
{
|
{
|
||||||
const wxChar *s = (const wxChar*) *this;
|
for ( const_iterator i = begin(); i != end(); ++i )
|
||||||
while(*s){
|
{
|
||||||
if(!wxIsalpha(*s)) return(false);
|
if ( !wxIsalpha(*i) )
|
||||||
s++;
|
return false;
|
||||||
}
|
}
|
||||||
return(true);
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxString::IsNumber() const
|
bool wxString::IsNumber() const
|
||||||
{
|
{
|
||||||
const wxChar *s = (const wxChar*) *this;
|
if ( empty() )
|
||||||
if (wxStrlen(s))
|
return true;
|
||||||
if ((s[0] == wxT('-')) || (s[0] == wxT('+'))) s++;
|
|
||||||
while(*s){
|
const_iterator i = begin();
|
||||||
if(!wxIsdigit(*s)) return(false);
|
|
||||||
s++;
|
if ( *i == _T('-') || *i == _T('+') )
|
||||||
}
|
++i;
|
||||||
return(true);
|
|
||||||
|
for ( ; i != end(); ++i )
|
||||||
|
{
|
||||||
|
if ( !wxIsdigit(*i) )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxString::Strip(stripType w) const
|
wxString wxString::Strip(stripType w) const
|
||||||
|
Reference in New Issue
Block a user