Card 20 / 76: You want to remove all leading and trailing whitespace from a string. Which method invocation will allow this to occur?
A)
stringName.trim();
B)
stringName.trim(' ');
C)
stringName.trim(" ");
D)
stringName.trimWhiteSpace();
Answer:
A) stringName.trim();
Previous Card | ← Previous Card Button |
Next Card | → Next Card Button |
Flip Card | Space-Bar |
B, C, and D are incorrect.
B and C are incorrect because these methods inappropriately try to receive arguments.
D is incorrect because there is no trimWhiteSpace method.
|