Good Stopping Point for 480 Prep
+- Phase6 Preparation to Step 3.
This commit is contained in:
parent
ca321e6c4e
commit
fd87d9a54d
3 changed files with 285 additions and 23 deletions
|
|
@ -16,6 +16,12 @@ 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
|
||||
|
|
@ -23,22 +29,50 @@ int main()
|
|||
|
||||
// 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
|
||||
// lowerString
|
||||
// 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");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue