// ENGR 131, Monday 3:30 Recitation (Amanda Rohn)
// Homework #8 - Fun With Strings
// Solution: Driver Program

#include <iostream>
#include <cassert>
#include <cctype>
#include "strfun.h"

using std::cout;
using std::cin;
using std::endl;

using namespace m330;


/*** Main Program ***/

int main()
{
	char str[10] = "abecdefg";
	int e1; int e2;	

	cout << "The first string is " << str;
	cout << "\nThe length is " << length(str) << endl;

	e1 = strpos(str,'e');
	e2 = strrpos(str, 'e');
	cout << "\nThe letter e first appears at index " << e1;
	cout << "\nThe letter e last appears at index " << e2 << endl;

	revstr(str);
	cout << "\nThe reversed string is " << str;

	substr(str,2,5);
	cout << "\nThe substring of the reversed string from index 2 to 5 is " << str << endl;

	char str2[10] = "  a c  ";
	cout << "\nThe trimmed version of '" << str2 << "' is ";
	trim(str2);
	cout << "'" << str2 << "'" << endl;

	char name[20] = " amanda e rohn ";
	cout << "\nThe capitalized version of '" << name << "' is ";
	ucwords(name);
	cout << "'" << name << "'" << endl << endl;

	return 0;
}
