# Project 2 String Solution

Write an assembly language program to obtain a line of input from the
keyboard (a string). Either a loop using the int 21h (function code 08) with
echo, a loop using the _getch function, or the getstr function may be used to
obtain the string. Limit the string to 50 characters maximum. Then, prompt
the user for which function is desired. The functions, as well as sample
outputs, are as follows:
Function 1: Determine where the first occurrence of a user-input character is
in the string (prompt the user for which character to search for). Spaces
count as a character.
Find the first ‘a’ in the string
Independence Day, 2012!
The first ‘a’ occurs in position 15
Function 2: Find the number of occurrences of a certain letter in a string
The letter ‘e’ occurs in the string
Independence Day, 2012!
4 times
Function 3: Find the length of the input string.
There are 23 characters in the string
Independence Day, 2012!
Note: the spaces count as a character in the overall length
Function 4: Find the number of characters of the input string.
There are 21 characters in the string
Independence Day, 2012!
Note: the spaces count as a character in the overall length
Function 5: Write a routine that replaces every occurrence of a certain letter
with another symbol
Replacing all of the d’s in the string
Independence Day, 2012!
With h yields
Inhepenhence Day
Note that the D remained unchanged.
Function 6: Capitalize the letters in the string
Capitalizing each letter in the string
Independence Day, 2012!
yields
INDEPENDENCE DAY, 2012!
Note that the numbers and punctuation marks remain unchanged
Function 7: Make each letter lower case
Making each letter lowercase in the string
Independence Day, 2012!
yields
independence day, 2012!
Note that the numbers and punctuation marks remain unchanged
Function 8: Toggle the case of each letter
Toggling of the letter in the string
Independence Day, 2012!
yields
iNDEPENCE dAY, 2012!
Note that the D remained unchanged.
Function 9: input a new string
Function 10: undo the last action that modified the string
Function 100: output the menu
Function 0: exit the program
Output the menu after obtaining the string for the first time. Prompt the user
for input where needed. Display prompts for any keyboard input needed is
required. The program must loop back for additional user input (new strings
or functions), and provide an exit function (function 0). Check for invalid
input for the menu; if the user enters an invalid input, re-output the menu
and ask for the function again.
Turn in a hard copy of your source code, as well as a hard copy of its
execution. In addition, please email the source code of your program (as an
attachment) to your instructor.