Topic: Strings Part 2 Points: 25
proper usages of constant parameters.
proper usages of constant functions.
proper usages of constant return values.
use of pointers
good use of encapsulation and information hiding
with your files from the previous
string assignment (or files given to you)
all paramters const
that should not be changed.
all member functions const that should not
change member variables.
all return values const that point or reference
a member variable.
sure your header file can be included twice. Use: #ifndef STRING_H #define STRING_H class
sure you have no duplicate code. (Use the functions you have written.)
all functions "this safe".
the functions described below.
sure to check for NULL pointers in every possible scenario.
Functions to Add
- subString - returns a String by value. It should take a starting
index and a length. If the starting index is < 0 start a 0. If
the starting index is > the length of the string return an empty
string. If the length goes past the end of the string, just stop at
- return true if the two values are equal. false
otherwise. It should take a String, char*, char or int.
- returns a char at the given index. It should take an integer as a
parameter. If there is not a character at the given index return
- toUpper - should change all of the characters in the string to
- toLower - should change all of the characters in the string to
- trimStart - removes all of the white-space from the beginning of
- trimEnd - removes all of the white-space from the end of the
- removes all of the white-space from the beginning and end of the String.
- should take two parameters. Search for all occurrences of the first
parameter and replace it with the second parameter. This function can
be called in 16 ways. replace(String, String) replace(String,
char*) replace(String, int)
replace(String, char) replace(char*, String) replace(char*,
char*) replace(char*, int)
replace(char*, char) replace(int, String)
replace(int, char*) replace(int, int) replace(int, char) replace(char, String)
replace(char, char*) replace(char, int)
replace(char, char) Be sure not to replace parts of the String
that you just added
You should only have to write one replace function. See the Conversion
Sorry to tell you now but this was true for all of the functions you have