// vsnprintf() will not terminate the string with '\0' if there is not
// enough place, but we want the string to always be NUL terminated
int rc = wxVsnprintfA(buf, len - 1, format, argptr);
- buf[len] = 0;
+ if ( rc == -1 )
+ {
+ buf[len] = 0;
+ }
return rc;
#endif // Unicode/ANSI
return npos;
}
-wxString wxString::substr(size_t nStart, size_t nLen) const
-{
- // npos means 'take all'
- if ( nLen == npos )
- nLen = 0;
-
- wxASSERT( nStart + nLen <= Len() );
-
- return wxString(c_str() + nStart, nLen == npos ? 0 : nLen);
-}
-
wxString& wxString::erase(size_t nStart, size_t nLen)
{
wxString strTmp(c_str(), nStart);