diff options
Diffstat (limited to 'other/Kermit/test/test_string.cpp')
| -rw-r--r-- | other/Kermit/test/test_string.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/other/Kermit/test/test_string.cpp b/other/Kermit/test/test_string.cpp new file mode 100644 index 0000000..ad2de42 --- /dev/null +++ b/other/Kermit/test/test_string.cpp | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #include <iostream> | ||
| 2 | #include <string> | ||
| 3 | #include <algorithm> | ||
| 4 | |||
| 5 | main () | ||
| 6 | { | ||
| 7 | string a = "Hallo,bla: foo!"; | ||
| 8 | int x = 0; | ||
| 9 | string b; | ||
| 10 | |||
| 11 | cout << count (a.begin (), a.end (), 'l') << endl; | ||
| 12 | x = a.find_first_of (","); | ||
| 13 | b.resize (x + 1); | ||
| 14 | a.copy (b.begin (), x); | ||
| 15 | cout << b << endl; | ||
| 16 | a.erase (0, x + 1); | ||
| 17 | |||
| 18 | cout << b << endl; | ||
| 19 | cout << a << endl; | ||
| 20 | } | ||
