subject

Write a method sameDashes that takes two Strings as parameters and that returns whether or not they have dashes in the same places (returning true if they do and returning false otherwise). For example, below are four pairs of Strings of equal length that have the same pattern of dashes. Notice that the last pair has no dashes at all. string 1: "hi--there-you." "-15-389" "criminal-plan" "abc"string 2: "12--(134)-7539" "-xy-zzy" "(206)555-1384" "9.8"To be considered a match, the Strings must have exactly the same number of dashes in exactly the same positions. The Strings might be of different length. For example, the following calls should each return true:sameDashes("1st-has-more characters", "2nd-has-less")sameDashes("1st-has- less", "2nd-has-more characters")because the Strings each have two dashes and they are in the same positions. But the following calls should each return falsebecause the longer string has a third dash where the shorter string does not:sameDashes("1st-has-more-charac ters", "2nd-has-less")sameDashes("1st-has- less", "2nd-has-more-characters")

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Your computer running windows 10 is doing some very strange things with the operating system. you are fairly certain it is not a hardware issue. you need to try to get further insight into what is going on within the operating system. which tool would be best suited for this?
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
This graph compares the cost of room and board at educational institutions in texas.
Answers: 1
question
Computers and Technology, 23.06.2019 05:00
Jason works as an accountant in a department store. he needs to keep a daily record of all the invoices issued by the store. which file naming convention would him the most?
Answers: 2
question
Computers and Technology, 23.06.2019 12:30
Animations and transitions are added from the
Answers: 1
You know the right answer?
Write a method sameDashes that takes two Strings as parameters and that returns whether or not they...
Questions
question
Biology, 12.02.2021 07:30
question
English, 12.02.2021 07:30
question
Mathematics, 12.02.2021 07:30