Question: in java Write the static method combine(String s1, String s2). This method should combine the left half of s1 with the right half of s2,

 in java Write the static method combine(String s1, String s2). This
in java

Write the static method combine(String s1, String s2). This method should combine the "left half" of s1 with the "right half" of s2, and return the result. The two halves are defined like this: The left half of s1 consists of the characters of s1 from the left side up to but not including the first character that's a digit (i.e., 0-9). If s1 contains no digits, then the "left half" is the entire string s1. If s1 begins with a digit, then the "left half" is the empty string. The right half of s2 consists of the characters of s2 from the right side down to but not including the first character that's a digit (i.e., 0-9). If s2 contains no digits, then the "right half" is the entire string s2. If s2 ends with a digit, then the "right half" is the empty string. Here are a few examples of how the combine method should work: combine("test123", "123anothertest") should return "testanothertest" combine("sloths", "are nice") should return "slothsare nice" combine("sloths", "are nice!!1") should return "sloths" Use only the following String methods in your solution: charAt, equals, indexOf, length, split, substring, to LowerCase, toUpperCase. Be sure to include the full method header. Do not include the class or main method. 12

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!