answersLogoWhite

0


Best Answer

String a=" Suraj ";

String t=a.trim();

this will remove all the leading and trailing white spaces

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What method of the string class removes all spaces from the beginning and end of a string object?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Can you define multiple parameters for one method in java?

The formal Java Language Specification does not list a hard limit on the number of formal parameters allowed. Generally, if you're worried that you might "run out" of parameter spaces, you will probably want to redesign your method.


Is there allowed to be spaces in HTML coding?

There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.There can be spaces between the words, but not in the middle of a word.


Write a program to count number of spaces in a string using array?

#include<iostream> #include<string> size_t count_spaces(std::string& str) { size_t spaces=0; for(size_t i=0; i<str.size(); ++i) if( str[i]==32 ) ++spaces; return( spaces ); } int main() { std::string str("This is a string with some spaces."); size_t spaces = count_spaces(str); std::cout<<"The string ""<<str.c_str()<<"" has "<<spaces<<" spaces.\n"<<std::endl; }


What is the difference between object and variable?

A variable basically holds a single type literal in memory through defining its type, declaring it, and setting a value to it. If you meant reference variables, they are variables which refer to the memory location of an object previously set.An object is the actual storage space in memory in which some collection of data resides (is stored). Objects 'live' in memory spaces known as 'heaps'.


How do you make a on peace sign HTML?

& #9774 ; all together..No spaces between "&" and #9774..No spaces in between #9774 and ";" ☮

Related questions

What was the first method of determining chemical composition of substances in spaces was to?

I suppose that this method was alpha spectrometry.


How many spaces come after the beginning quotation mark?

none


What is the fourth dimension in architecture?

Only if we are scaling small spaces as large spaces, density can be increasing when comparing the smaller object with the larger object so truly the larger object might be even larger


What is all the spaces on the surface plane of an object?

well it depends on the polygon


What change took place on Trading Spaces beginning in March 2005?

no host


How many letters are in this sentence?

Without Spaces or punctiation - 30 Without Spaces - 31 With Space and no Punctuation - 37 With Space and no Punctuation if there is a space at the beginning - 38 With space and punctiation - 38 With Spaces and punctiation if there is a space at the beginning - 39 If you you mean the word letters then there is one. If you mean literal tangible letters then there are none.


How many squares have no checkers on a checker board?

At the beginning of the game, there are 40 spaces that don't have checkers on them.


Apostrophe at the beginning of a word for slang?

It's not necessarily at the beginning of the word. The apostrophe is used to represent missing letters and spaces in slang words. An example is "y'all"


What type of game is hopscotch?

Hopscotch is a children's game that can be played with several players or alone. Hopscotch is a popular playground game in which players toss a small object into numbered spaces of a pattern of rectangles outlined on the ground and then hop through the spaces to retrieve the object.


He said it to his sistershe said to his brothers what did the witty raindrop exclaim to all the others?

"Two's company and Three's a Cloud." No Spaces!! (: hope this can help!


What has the author Roeland Peter Buitelaar written?

Roeland Peter Buitelaar has written: 'The method of averaging in Banach spaces'


How many spaces should there be after a period and before the beginning of the next sentence?

It is recommended to use only one space after a period before starting the next sentence. This standard has become widely accepted in modern typography and word processing.