Dealing with Strings Flashcards

1
Q

String.toLowerCase()

A

xxx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

String.format()

A

xxx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Parsing values from String

A

xxx

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

String format()

A
  • a method returns the formatted string by given locale, format, and arguments
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly