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:
Vadim Zeitlin
1998-06-18 13:20:42 +00:00
parent b841e0e379
commit c8cfb486fb
2 changed files with 25 additions and 4 deletions

View File

@@ -349,12 +349,16 @@ public:
//@}
//@}
/** @name formated output */
/** @name formated input/output */
//@{
/// as sprintf(), returns the number of characters written or < 0 on error
int Printf(const char *pszFormat, ...);
/// as vprintf(), returns the number of characters written or < 0 on error
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

View File

@@ -569,7 +569,7 @@ wxString wxString::Right(char ch) const
if ( iPos == NOT_FOUND )
str = *this;
else
str = c_str() + iPos;
str = c_str() + iPos + 1;
return str;
}
@@ -837,7 +837,7 @@ int wxString::Find(const char *pszSub) const
}
// ---------------------------------------------------------------------------
// formatted output
// formatted input/output
// ---------------------------------------------------------------------------
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)
{
static char s_szScratch[1024];
static char s_szScratch[1024]; // @@@@ shouldn't use fixed-size buffer!
int iLen = vsprintf(s_szScratch, pszFormat, argptr);
AllocBeforeWrite(iLen);
@@ -862,6 +862,23 @@ int wxString::PrintfV(const char* pszFormat, va_list argptr)
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
// ---------------------------------------------------------------------------