added and documented wxString::StartsWith()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7197 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-04-17 17:30:01 +00:00
parent 897e170014
commit b8be5a9f03
4 changed files with 83 additions and 6 deletions

View File

@@ -2408,6 +2408,32 @@ static void TestStringSub()
printf("substr(3, 5) = '%s'\n", s.substr(3, 5).c_str());
printf("substr(3) = '%s'\n", s.substr(3).c_str());
static const wxChar *prefixes[] =
{
_T("Hello"),
_T("Hello, "),
_T("Hello, world!"),
_T("Hello, world!!!"),
_T(""),
_T("Goodbye"),
_T("Hi"),
};
for ( size_t n = 0; n < WXSIZEOF(prefixes); n++ )
{
wxString prefix = prefixes[n], rest;
bool rc = s.StartsWith(prefix, &rest);
printf("StartsWith('%s') = %s", prefix.c_str(), rc ? "TRUE" : "FALSE");
if ( rc )
{
printf(" (the rest is '%s')\n", rest.c_str());
}
else
{
putchar('\n');
}
}
puts("");
}
@@ -2688,15 +2714,15 @@ int main(int argc, char **argv)
TestPChar();
TestString();
}
TestStringSub();
if ( 0 )
{
TestStringConstruction();
TestStringSub();
TestStringFormat();
TestStringFind();
TestStringTokenizer();
TestStringReplace();
}
TestStringReplace();
#endif // TEST_STRINGS
#ifdef TEST_ARRAYS