Have you ever found yourself writing a function to do something that seems pretty simple, then months or years later you find out there's a built-in function to accomplish exactly what you were doing? Maybe you didn't know where to look or the built-in function's name was confusing. I'd argue that Java's toUpperCase() does not fall in this category.
Somehow I imagine that if you were to reverse engineer the built-in method, it wouldn't look like this implementation (submitted anonymously):
private static String upperCaseIt(String Account) { String result = ""; int i = 0; while (Account.length() > i) { if (Account.substring(i,i+1).equals("a")) { result = result + "A";} else { if (Account.substring(i,i+1).equals("b")) { result = result + "B";} else { if (Account.substring(i,i+1).equals("c")) { result = result + "C";} else { if (Account.substring(i,i+1).equals("d")) { result = result + "D";} else { if (Account.substring(i,i+1).equals("e")) { result = result + "E";} else { if (Account.substring(i,i+1).equals("f")) { result = result + "F";} else { /* I'm sure you get the idea. */ } } } } } } i++; } return result; }
[Advertisement]
BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!