What does the String method trim() do? Give an example of its use.

What will be an ideal response?


The string method trim removes leading and trailing white space, as well as the tab and
new-line character from String objects. For example, the following is an invocation of trim():
String s = userInput.trim();
where s represents the new String with no white space, tab or new-line characters.

Computer Science & Information Technology

You might also like to view...

Unlike the procedure header, which varies with each procedure, the procedure footer for an independent Sub procedure is always ____.

A. End B. End Sub C. Sub Foot D. Foot Sub

Computer Science & Information Technology

            As shown in the accompanying figure, the ____ displays one day at a time.

A. item area B. Date Navigator C. My Calendars pane D. Schedule View

Computer Science & Information Technology

A ________ is a network located in your residence that connects to all your digital devices

A) LAN B) HAN C) MAN D) WAN

Computer Science & Information Technology

In which database model can objects have multiple parents?

A. Hierarchical B. Network C. Object-oriented D. Object-relational

Computer Science & Information Technology