Dealing with Strings Flashcards
1
Q
String.toLowerCase()
A
xxx
2
Q
String.format()
A
xxx
3
Q
Parsing values from String
A
xxx
4
Q
How to convert int and Integer into String and vice versa?
A
Convert int to String
- int + “”
- Integer.toString(int)
- String.valueOf(int)
- String.format()
Convert String to int
- Integer.parseInt(String)
- Integer.valueOf(String)
5
Q
String format()
A
- a method returns the formatted string by given locale, format, and arguments
6
Q
Common String Format Specifiers
A
- %d: integer -> decimal integer
- %f: floating point -> decimal number
- %e: floating point -> decimal number in scientific notation
- %s: any type -> String value
- %t: Date/Time -> %t is the prefix for Date/Time conversions. More formatting flags are needed after this.