Write a program that will read a message from another text file and surround each occurrence of an abbreviation with <> brackets. Write the marked message to a new text file. For example, if the message to be scanned is How are u today? Iirc, this is your first free day. Hope you are having fun! :) the new text file should contain How are today? , this is your first free day. Hope you are having fun!
<:)>
Text messaging is a popular means of communication. Many abbreviations are in common use but are not appropriate for formal communication. Suppose the abbreviations are stored, one to a line, in a text file named abbreviations.txt. For example, the file might contain these lines:
lol
:)
iirc
4
u
ttfn
The solution for this project makes use of a couple methods that break out the processing of a line. The major method processes and marks a line for a single abbreviation. It finds the index of the abbreviation in the line and then breaks the line up into 3 parts. It then gets the character immediately before and after the abbreviation and checks to see if either is a letter or digit. If so, then we assume that the abbreviation is part of a legal word and don’t mark it. Otherwise, we splice in the <> marker. This is done in a while loop that processes the remaining part of the line until the abbreviation is not found.
See the code in AbbreviationMarker.java.
You might also like to view...
You must set an initializer value when you create an array.
Answer the following statement true (T) or false (F)
In the figure above, which item sets up SkyDrive and makes sure it is synced with your computer?
A. Item 1 B. Item 2 C. Item 3 D. Item 4