How to capitalize the first letter of a String in Java

In Java, we can use substring(0, 1).toUpperCase() + str.substring(1) to make the first letter of a String as a capital letter (uppercase letter) String str = "mkyong"; String str1 = str.substring(0, 1).toUpperCase(); // first letter = M String str2 = str.substring(1); // after 1 letter = kyong String result = str.substring(0, 1).toUpperCase() + str.substring(1); // …

Read more

MongoDB – Update to upper case

A document, and you want to update all the ‘source’ values to UPPERCASE. whois.json { “_id” : NumberLong(1), “country” : “au”, “source” : “apnic” } { “_id” : NumberLong(2), “country” : “cn”, “source” : “apnic” } { “_id” : NumberLong(3), “country” : “us”, “source” : “arin” } Solution No sure if there is any ready …

Read more