11. |
Write a command line program that performs conversions on a text file.
java Convert [-uc] [-oc word] inputfile outputfile
Using the text,
The mice will see you now
as an example, below is a description of parameters:
Parameter
| Description
| Example
|
-uc
| finds each lowercase letter c in the text file, and converts it to uppercase
| -uo
|
The mice will see yOu nOw
| | |
-oc word
| finds each word in the file beginning with the character c (not case sensitive) and adds word after it separated by commas.
| -oM ouch
|
The mice, ouch, will see you now
| | |
inputfile
| name of the file to convert
|
|
outputfile
| name of the file to save the converted file to
|
|
Allow multiple parameters, such as
java Convert -uo -ui -om ouch -ow like mouse.txt changed.txt
Output to changed.txt :
The mIce, ouch, wIll, like, see yOu nOw
Answer:
|