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

// File: strfun.h
// Contains prototypes and descriptions of string manipulation functions

/*
*	int length(const char * s)
	Description: finds the length of s
	Preconditions: s is a valid C-style string
	Postconditions: s has not been changed

*	int strpos(const char * s, char b)
	Description: returns the index of the first occurrence of b in s.
				 If b does not occur in s, returns -1.
	Preconditions: s is a valid C-style string
				   b is a character other than \0
	Postconditions: s has not been changed

*	void revstr(char * s)
	Description: reverses the string s
	Preconditions: s is a valid C-style string
	Postconditions: s has been reversed and is still a valid C-style string

*	int strrpos(const char * s, char c)
	Description: returns the index of the last occurrence of c in s.
				 If c does not occur in s, returns -1.
	Preconditions: s is a valid C-style string
				   c is a character other than \0
	Postconditions: s has not been changed

*	void substr(char * s, int a, int b)
	Description: Takes the substring from positions a through b
	Preconditions: s is a valid C-style string, a is less than or equal to b
	Postconditions: s has been changed to only contain the substring that was originally
					contained in positions a through b. it is still a valid C-style string.

*	void trim(char * s)
	Description: Removes whitespace from the beginning and end of s.
	Preconditions: s is a valid C-style string.
	Postconditions: s has been changed by removing whitespace at the beginning and end.
					s is still a valid C-style string.

*	void ucwords(char * s)
	Description: Capitalizes the first character of each word in s.
	Preconditions: s is a valid C-style string.
	Postconditions: s has been changed by capitalizing the first character of each word.
					s is still a valid C-style string.
*
*/

namespace m330 {

// length finds the length of s
int length(const char * s);

// strpos returns the index of the first occurrence of b in s
int strpos(const char * s, char b);

// revstr reverses the string s
void revstr(char * s);

// strrpos returns the position of the last occurrence of c in s
int strrpos(const char * s, char c);

// substr takes the substring from positions a through b
void substr(char * s, int a, int b);

// trim removes whitespace from the beginning and end of s
void trim(char * s);

// ucwords capitalizes the first character of each word in s
void ucwords(char * s);

}	//end namespace