//
// teststr.cpp
//
// Program to test the cstring class.
//
// Computer Science S-111, Harvard University
//

#include <iostream.h>
#include "cstring.hpp"


int main()
{
    cstring *str1;
	cstring *strcpy;
	cstring *partA;
	cstring *partB;

    // Input, output, and length.
    cout <<  "Type a string:\n";
    cin >> str1;
    cout << "Your string is: " << str1 << endl;
    cout << "Its length is " << length(str1) << " characters.\n";
    
    cout << "Extract item at 3 ";
    cout << extract(str1, 3) << " " << endl;
    
    cout << "First case of 'a' " << index(str1, 'a') << endl;
    
    cout << "Test pointing at item 3 ";
    cout << (int) point(str1, 3) << endl;
    
    cout << "copy the string " << str1 << endl;
    strcpy = copystr(str1);
    cout << "New STR: " << strcpy << endl;
    
    cout << "split at 4 " << endl;
    split(str1, 4, partA, partB);
    
    cout << "partA: " << partA << endl;
    cout << "partB: " << partB << endl;
    cout << " Orig: " << str1 << endl;

}

