Question: android studio excercises non-empty string, this method extracts the timest amp embedded in it, and ssed as a 4-digit time using the 24-hour clock. The
android studio excercises
non-empty string, this method extracts the timest amp embedded in it, and ssed as a 4-digit time using the 24-hour clock. The return is thus of l erurns it ex re where hh ranges from "00 to "23" and mm tanges from"00" to 59 the public static String get24Time(String str) amp is a substring made up of an integer value between 1 and 12 (representing followed by : (a colon) followed by a two-digit string between "80 and 59 hour) the resenting the minute) followed optionally by some whitespace followed by the string an"or "pm" in upper, lower, or mixed case. You can convert a timestamp to a 24-hour clock by simply adding 12 to the hour if the ime is in the afternoon. If the entered string has no timestamp embedded in it then return the empty string, and i it has more than one then return the one that accurs last. For example, if str is the string There was a change from 4:35 to 9:25 Pm tomorrow. then the return should be the string 2125 This is because the relevant timestamp) is the second; Le"9:25 pm, and since it is ir afternoon, we add 12 to the hoursStep by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
