Solved

how to remove leading space in a string

Posted on 2008-10-10
3
1,779 Views
Last Modified: 2013-12-29
how to remove leading space in a string

for example

String temp="apple                               ";

i want to remove all the space at the end, and would be

String temp="apple"
0
Comment
Question by:priyapratheep
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
divyeshhdoshi earned 250 total points
ID: 22685125
you can use trim method
like
temp.trim();

0
 
LVL 5

Assisted Solution

by:varungd
varungd earned 250 total points
ID: 22685210
String temp = "apple                               ".Trim();

or  

temp=temp.Trim();
0
 
LVL 23

Expert Comment

by:Ajay-Singh
ID: 22685260
There is no method like Trim(); its trim()


String temp = temp.trim();
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Glassfish admin console not working 1 88
Html Table Looping (part 2) 5 42
Given a github repo find email address of all collaborators in that repo 1 56
Java array 10 89
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question