// header files #include "StringUtils.h" // constants /* Name: main Process: Runs the String Utilities Function input/parameters: NONE Function output/parameters: NONE Function output/returned: NONE Device input/---: NONE Device output/---: NONE Dependencies: included by standard libraries */ int main() { // define/initialize variables char testStringOne[] = "My New Testing String!!!"; char testStringTwo[MAX_STR_LEN]; char testStringThree[MAX_STR_LEN]; char testStringFour[MAX_STR_LEN]; char testStringFive[MAX_STR_LEN]; int stringLength, subStrStart; printf("\n---Phase 6: All String Utilities---\n"); printf("=====================================\n"); // get user input // do calculations // string length // getStringLength stringLength = getStringLength(testStringOne); printf("\nThe length of string '%s' is %d.\n", testStringOne, stringLength); // string copy // copyString copyString(testStringTwo, testStringOne); printf("\nCopied string '%s' from string '%s'\n", testStringTwo, testStringOne); // string concatenate // catString catString(testStringTwo, " and this is concatenated."); printf("\nConcatenated string: '%s'\n", testStringTwo); // string compare (<, >, =) // compareString if(compareString("ONE", "TWO") > 0) { printf("\n'ONE' is greater than 'TWO'\n"); } if(compareString("TWO", "ONE") < 0) { printf("\n'TWO' is less than 'ONE'\n"); } if(compareString("ONE", "ONE") == 0) { printf("\n'ONE' is equal to 'ONE'\n"); } // string substring get // substringGet getSubString(testStringThree, testStringTwo, 34, 44); printf("\nSubstring found: '%s'\n", testStringThree); // string substring find // substringFind subStrStart = findSubString(testStringTwo, "this is"); printf("\nSubstring start: %d\n", subStrStart); // string set to lower // strToLowerCase strToLowerCase(testStringFour, testStringTwo); printf("\nLowercase String: '%s'\n", testStringFour); // string get to delimiter // stringDelimiter getStringToDelimiter(stdin, '.', testStringFive); printf("\nCaptured to delimiter: '%s'\n", testStringFive); // string get to end of line // stringEOL getStringToLineEnd(stdin, testStringFive); printf("\nCaptured to end of line: '%s'\n", testStringFive); // display results printf("\nProgram End\n"); // return success return 0; }