1) Right(char ch) now returns the part of the string after the last
occurence of ch _without_ ch itself (like Left(char ch)) 2) Added wxString::Scanf() and wxString::ScanfV() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -349,12 +349,16 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/** @name formated output */
|
/** @name formated input/output */
|
||||||
//@{
|
//@{
|
||||||
/// as sprintf(), returns the number of characters written or < 0 on error
|
/// as sprintf(), returns the number of characters written or < 0 on error
|
||||||
int Printf(const char *pszFormat, ...);
|
int Printf(const char *pszFormat, ...);
|
||||||
/// as vprintf(), returns the number of characters written or < 0 on error
|
/// as vprintf(), returns the number of characters written or < 0 on error
|
||||||
int PrintfV(const char* pszFormat, va_list argptr);
|
int PrintfV(const char* pszFormat, va_list argptr);
|
||||||
|
/// as sscanf()
|
||||||
|
int Scanf(const char *pszFormat, ...) const;
|
||||||
|
/// as vsscanf()
|
||||||
|
int ScanfV(const char *pszFormat, va_list argptr) const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
// get writable buffer of at least nLen characters
|
// get writable buffer of at least nLen characters
|
||||||
|
@@ -569,7 +569,7 @@ wxString wxString::Right(char ch) const
|
|||||||
if ( iPos == NOT_FOUND )
|
if ( iPos == NOT_FOUND )
|
||||||
str = *this;
|
str = *this;
|
||||||
else
|
else
|
||||||
str = c_str() + iPos;
|
str = c_str() + iPos + 1;
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
@@ -837,7 +837,7 @@ int wxString::Find(const char *pszSub) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// formatted output
|
// formatted input/output
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
int wxString::Printf(const char *pszFormat, ...)
|
int wxString::Printf(const char *pszFormat, ...)
|
||||||
{
|
{
|
||||||
@@ -853,7 +853,7 @@ int wxString::Printf(const char *pszFormat, ...)
|
|||||||
|
|
||||||
int wxString::PrintfV(const char* pszFormat, va_list argptr)
|
int wxString::PrintfV(const char* pszFormat, va_list argptr)
|
||||||
{
|
{
|
||||||
static char s_szScratch[1024];
|
static char s_szScratch[1024]; // @@@@ shouldn't use fixed-size buffer!
|
||||||
|
|
||||||
int iLen = vsprintf(s_szScratch, pszFormat, argptr);
|
int iLen = vsprintf(s_szScratch, pszFormat, argptr);
|
||||||
AllocBeforeWrite(iLen);
|
AllocBeforeWrite(iLen);
|
||||||
@@ -862,6 +862,23 @@ int wxString::PrintfV(const char* pszFormat, va_list argptr)
|
|||||||
return iLen;
|
return iLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxString::Scanf(const char *pszFormat, ...) const
|
||||||
|
{
|
||||||
|
va_list argptr;
|
||||||
|
va_start(argptr, pszFormat);
|
||||||
|
|
||||||
|
int iLen = ScanfV(pszFormat, argptr);
|
||||||
|
|
||||||
|
va_end(argptr);
|
||||||
|
|
||||||
|
return iLen;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxString::ScanfV(const char *pszFormat, va_list argptr) const
|
||||||
|
{
|
||||||
|
return vsscanf(c_str(), pszFormat, argptr);
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// standard C++ library string functions
|
// standard C++ library string functions
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user