I have a String format String:
String.format("CREATE TABLE %s ("
+ "%S INTEGER PRIMARY KEY AUTOINCREMENT, %s INTEGER NOT NULL, %s TEXT NOT NULL)",
SPORT_TABLE, SPORT_ID, SPORT_WSID, SPORT_TITLE);
But my second argument (SPORT_ID
) is being capitalized. Why is this happening? What can I do to fix this?
In java, String format() method returns a formatted string using the given locale, specified format string, and arguments. We can concatenate the strings using this method and at the same time, we can format the output concatenated string.
By convention, java Objects have capitalized first-letter names (e.g. String), while primitives have lower case names (e.g. int, float, double, etc.) Save this answer.
Python format() In this tutorial, we will learn about the Python format() function with the help of examples. The format() method returns a formatted representation of the given value controlled by the format specifier.
In this quick tutorial, you will learn how to capitalize the first letter of a string in Java. Unfortunately, the String class does not provide any method to capitalize strings.
It is a perfectly documented behavior even if not a well known one (probably because it's neither an obvious need nor something very useful).
From the javadoc :
The following table summarizes the supported conversions. Conversions denoted by an upper-case character (i.e. 'B', 'H', 'S', 'C', 'X', 'E', 'G', 'A', and 'T') are the same as those for the corresponding lower-case conversion characters except that the result is converted to upper case according to the rules of the prevailing Locale. The result is equivalent to the following invocation of String.toUpperCase()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With