addDelimiter: public static java.lang.String addDelimiter​(java.lang.String str, char delimeter) Returns a string where characters are separated by the specified delimeter character. A string with a single character will not have a delimeter added. The space character is consider a character (similar to character 'A'). You can assume str will never be the empty string. You may not use an auxiliary method in order to implement this method. Your implementation must be recursive and you may not use any loop construct. Note: In java given two characters a and b, a + b will not create a string. To create a string, append a to the empty string and the result to b. From the String class, the only methods you can use are length(), isEmpty(), charAt() and substring. Do not use ++ or -- in any recursive call argument. It may lead to an infinite recursion. For example, use index + 1, instead of index++. Parameters: str - delimeter - Returns: String with characters separated by delimiter or the original str if the string has a single character

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter7: Characters, Strings, And The Stringbuilder
Section: Chapter Questions
Problem 12RQ
icon
Related questions
Question

Class Utilities {

Method Details

addDelimiter:

public static java.lang.String addDelimiter​(java.lang.String str, char delimeter)
Returns a string where characters are separated by the specified delimeter character. A string with a single character will not have a delimeter added. The space character is consider a character (similar to character 'A'). You can assume str will never be the empty string. You may not use an auxiliary method in order to implement this method. Your implementation must be recursive and you may not use any loop construct. Note: In java given two characters a and b, a + b will not create a string. To create a string, append a to the empty string and the result to b. From the String class, the only methods you can use are length(), isEmpty(), charAt() and substring. Do not use ++ or -- in any recursive call argument. It may lead to an infinite recursion. For example, use index + 1, instead of index++.

Parameters:

str -

delimeter -

Returns:

String with characters separated by delimiter or the original str if the string has a single character

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Math class and its different methods
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,