Fahimeh.Fakour
BAN USERThis solution doesn't ensure all other characters are lower case.
ex: for the string ABCDEFGHIJ your code would return ABCDEFGHIJ. while the expected result (from what I understand from the question): ABcdEfgHij
It actually took me a while to finally go with the following solution:
public static int calcString(String str){
int sum =0;
Pattern p = Pattern.compile("[+-]?\\d+");
Matcher m = p.matcher(str);
while (m.find()) {
sum += Integer.parseInt(m.group().trim());
}
return sum;
}
RepSandraGabriel, Analyst at ABC TECH SUPPORT
We Data Entry Operators have a variety of duties, including processing documents, solving inconsistencies, securing information, updating databases and using ...
Repsylviatobins, Applications Developer at 247quickbookshelp
Hi, I am Sylvia Law librarian. I am an information resource expert. I work in law schools, corporate law departments ...
If I understand correctly, the program should do the following:
1) preserve first character as-is (since the change in case is happening starting after 2nd character)
2) all characters after the second character should be lower case EXCEPT every 3rd character
ex: abcdefghij -> aBcdEfgHij
ABCDEFGHIJ -> ABcdEfgHij
aBCDEFGHIJ -> aBcdEfgHij
- Fahimeh.Fakour February 21, 2018