home *** CD-ROM | disk | FTP | other *** search
- //----------------------------------------------------------
- // CSTEST.CPP -
- // (c) 1991 by Thole Groeneveld & toolbox -
- //----------------------------------------------------------
-
- #include <iostream.h>
- #include "cstring.h"
-
- void Fehlerroutine () {
- cout << "Überschreitung des Bereiches\n";
- }
-
- main() {
- String s;
- String s1("Dies ist ");
- String s2("ein Testsatz");
-
- String::SetToErrHandler (Fehlerroutine);
-
- cout << endl << endl;
- s = s1 + s2;
- cout << s << endl;
- cout << s.len() << endl;
- cout << s.Left(4) << endl;
- cout << s(5, 20) << endl;
- cout << s.Right(8) << endl;
-
- char c = s[0];
- cout << c << endl;
- c = s[-4]; // Aufruf der Fehlerroutine
- s.InsertAt (s.Find ("Testsatz"), "interessanter ");
- cout << s << endl;
- s.WriteAt (s.Find ("interessanter"), "langweiliger ");
- cout << s << endl;
-
- s.ToUpper() // Durch Rückgabeparameter "*this"
- .Reverse(); // können mehrere Funktionen aneinander
- // gehängt werden!
- cout << s << endl;
-
- s = ToString(1.234);
- cout << s << endl;
- double d = double(s);
- cout << d << endl;
-
- cout << long(ToString(1234567890)) << endl;
- }
- //----------------------------------------------------------
- // Ende von CSTEST.CPP -
-