Question: (Java) How to write a command line function that does the following: -d where integer is a number greater than or equal to 0. Funtion

(Java) How to write a command line function that does the following:

-d where integer is a number greater than or equal to 0. Funtion will remove all but the first occurrences of any specific character.

For example:

Text.txt: a ab_abc abcd_abcd

-d 3 Text.txt

Results in: "a ab_abc bcd_cd"

Additional Example:

File contains: "

Text1.txt "Howdy Billy, " + "I am going to take cs6300 and cs6400 next semester. " + "Did you take cs 6300 last semester? I want to " + "take 2 courses so that I will graduate Asap!"

-d 1 Text1.txt

Result:

"Howdy Bil, " + "Iamgntkecs6304xr." + "Du?" + "2hAp!"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!